开发者

Multiple Databases in Ado.net Entity framework for Mysql Provider

开发者 https://www.devze.com 2023-03-19 05:57 出处:网络
I want to have access to 2 different databases in Ado.net Entity framework. I created one .edmx file inproject, how can i access two different database in single .edmx fileDatabase provider is M开发者

I want to have access to 2 different databases in Ado.net Entity framework. I created one .edmx file in project, how can i access two different database in single .edmx file Database provider is M开发者_运维问答ySQL.

Regards, venkateswararao


Are two databases are same or different?

If same than you can use one emdx against both, you just have to create 2 dabase context objects with 2 different connection strings.

If they are different than you have to create 2 different emdx files.


It is not possible. You must have separate EDMX file (and context) for each database. There are some ugly workarounds like exposing tables from second database via views in the first database (so EDMX talks only to the first database) but that brings other problems because views are read only in EF unless you create CUD stored procedures for every table exposed as a view.


Preparing an Entity Framework model for multi provider support

Look To This Go To Link

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号