Views and Entity Framework

痴心易碎 提交于 2019-12-01 15:40:32
Greg Jackman

There's a great answer to that here: Entity Framework and SQL Server View (see accepted answer: https://stackoverflow.com/a/2715299/53510.)

EF infers a PK for views by combining all non-nullable fields. You can use ISNULL and NULLIF to manipulate the nullability of view columns thereby forcing EF to pick the PK you want.

There is no keys in firebird views. Instead, set one (or more) field as 'not null' with the following command:

update RDB$RELATION_FIELDS set RDB$NULL_FLAG = 1 where (RDB$FIELD_NAME = 'A_FIELD') and (RDB$RELATION_NAME = 'A_VIEW')

Then re-import the database in entity framework.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!