使用 Visual Studio 2010 统一两个模型 (edmx)
你好,实际上据我所知,你不能在两个模型之间建立关系,或者在一个模型中拥有来自两个数据库的实体,有可能两个模型都与现有数据库相连接吗?或者对以下方法有一些经验:
将实体从其中一个的设计者移动到另一个,以及一些 bcp(SQL 服务器)魔术来仅在一个数据库上移动数据和重新创建?
谢谢。
Hello as actually as i know you can not make relations between tow models or have in one models entities from two databases, it's a posibility two join two models both of them with existig databases behind? or there is some experience with a method like:
move entities from the designer of one of them to the other and some bcp (SQL server) magic to move data and recreation on only one database?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,答案是:不,您不能加入针对不同数据库的模型,也不能将多个数据库中的实体放入单个模型中。但是,您应该能够在来自针对同一数据库的多个模型的实体之间建立关系。这些文章中的更多内容:第 1 部分,第 2 部分。
多个数据库的部分解决方法可以是表示第一个模型中第二个数据库中的表的视图,并直接在模型中创建关系(通过具有引用约束的外键关联),但我没有尝试这样做。
As I know the answer is: No you can't join models targeting different databases and you can't place entities from multiple databases in single model. However you should be able to make relations among entities from multiple models targeting the same database. More in these articles: part 1, part 2.
The partial workaround for multiple databases can be views representing tables from the second database in your first model and creating relations directly in the model (by Foreign key associations with referential constraints) but I didn't try this.