SQL Server“用户模式分离”和实体框架问题 [英] SQL Server "User-Schema Separation" and Entity Framework issues

查看:140
本文介绍了SQL Server“用户模式分离”和实体框架问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b $我已经用一个数据库愚弄了一个数据库,这个数据库已经实现了用户模式的分离,有一个名称相同但是通过模式分开的多个表。 b

所以喜欢:



admin.tasks

staff.tasks

contractor.tasks



当我创建了我的EF模型,我注意到有3个任务表:



任务_
tasks1

tasks2



这是按设计吗?



还有一个方式告诉EF将模式添加到实体的名称或我是SOL,并自己做?

解决方案

我相信Codeplex上的实体框架运行时模型适配器库布兰登·海恩斯可能会解决你的问题。它将允许您在运行时更改模式名称。只要表的模式在每种情况下都相同,这应该相当简单。


I have been fooling around with EF with a database that has implemented user-schema separation with a twist, there are multiple tables with the same name but are separated via the schema.

So like:

admin.tasks
staff.tasks
contractor.tasks

When I created my EF model I noticed that there were 3 tasks tables:

tasks
tasks1
tasks2

Is this by design?

Also is there a way to tell EF to add the schema to the name of the entity or am I SOL and doing it myself?

解决方案

I believe that the Entity Framework Runtime Model Adapter library on Codeplex from the mind of Brandon Haynes may solve your problem. It will allow you to change the schema name at runtime. As long as the schema of the table is the same in each case this should be fairly simple to implement.

这篇关于SQL Server“用户模式分离”和实体框架问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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