开发者

Calling a SQL Server View from EF 4.1 context object

开发者 https://www.devze.com 2023-03-13 01:51 出处:网络
Has anyone had experience with calling a view using EF 4.1 DBContext object? If so could you provide an e开发者_开发技巧xample. Also will this map to a POCO like a table does?

Has anyone had experience with calling a view using EF 4.1 DBContext object? If so could you provide an e开发者_开发技巧xample. Also will this map to a POCO like a table does?

Thanks much, Derek


It should be used just like a regular table - POCO with name of the view as the table.


I have called Oracle Views using EF 4. There is one requirement to add views to edmx and that is that you need to make a primary key column in it. One way to do that is to make a column containing row numbers and make it primary. Then it would be easily added to edmx.

As far as the last part of your question is concerned, Yes they will be accessible just like other tables using dbcontext.

Hope it helps.

0

精彩评论

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