EF4两款车型一个数据库,可能吗? [英] EF4 two models one database, possible?

查看:130
本文介绍了EF4两款车型一个数据库,可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找这个答案,似乎无法找到任何东西,但我EF4要创建一个基本模型,并把我们的基础,我们创建任何新的项目,如果我们需要自定义添加表该网站数据库是否有可能增加一个模型只是那些特定的表和我们的基础将其链接到模型
我似乎无法找到这样的一个很好的资源,这似乎是像它会是有一个可重用的示范基地和一个单独的一个很正常的事情任何一个关闭的

I have been searching for this answer and can't seem to find anything, but with EF4 I want to create a base model and put in our 'foundation' and any new project we create if we need to add custom tables to that sites db is it possible to add a model with just those specific tables and link it to the model in our 'foundation' I can't seem to find a good resource on something like this and this seems to be like it would be a normal thing to have a reusable base model and a separate one for any one off's

感谢任何帮助或指针!

Thanks for any help or pointers!

推荐答案

是 - 在某种程度上。

Yes - in a way.

您最终将有两个独立的,不同的对象背景 - 一个来自你的基础的基本表和类,另一个是具体项目的模式

You would end up having two separate, distinct Object contexts - one from your "foundation" with the basic tables and classes, and another from project-specific model.

问题是:你不能从一个上下文移到实体到另一个...所以只要这些实体从来没有以任何方式交互,那么你会没事的。

Trouble is: you cannot move entities from one context to another... so as long as those entities never have to interact in any way, then you'll be fine.

这篇关于EF4两款车型一个数据库,可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆