开发者

Splitting the Db model in EF 4.1

开发者 https://www.devze.com 2023-03-17 06:55 出处:网络
Anyone suggest me how to handle the following scenario. I have some Db tables that are using in all of my projects so I am creating all these tables in every database (common tables + project tables).

Anyone suggest me how to handle the following scenario. I have some Db tables that are using in all of my projects so I am creating all these tables in every database (common tables + project tables). Now I have a common data and business libraries that depend on the common tables, I need to split these table entities into two different libs with a single DbContex. I 开发者_C百科am using the dependency injection to pass the db context.

I am using the following Vs tools. EF 4.1 VS 2010.

Regards, Hareen.


You can either use inheritance like below or

public class CommonContext:DbContext
{
}

public class ProjectContext:CommonContext
{
}

Composition like this. (The answer I have given for your earlier question

0

精彩评论

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