.net - 如何首先使用 EF 4 代码将对象映射到 View ?

标签 .net entity-framework entity-framework-4 ef4-code-only

如何首先使用 EF 4 代码将实体映射到数据库 View ?

有没有办法通过从 EntityConfiguration 类派生来做到这一点?

最佳答案

是的!
我找到了答案:

You can certainly use Code First to map to a view, just tell Code First that it's a table and it will use the same SQL against the view that it would for a table. Obviously if your view isn't writeable then saving is going to fail if you try and update values in the entities that are based on the view, but we will just delegate to the database so if you don't update these entities then you won't have any issues.



http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/f154595c-717e-4703-a81d-ee63633a481e

关于.net - 如何首先使用 EF 4 代码将对象映射到 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3595786/

相关文章:

entity-framework - 扩展 Entity Framework 模型

c# - 我可以使用 Entity Framework Code First 指定子实体默认排序吗?

c# - Entity Framework 4 : What causes . Take(10) 返回 20 条记录?

sql-server - Entity Framework Code First - 更改表列排序规则

.net-4.0 - 从 3.5 升级到 4 时 edmx 文件中的警告

.net - 创建 Web 控件时应该重写 OnLoad 还是实现 Page_Load

c# - "AsDynamic()"在哪里?

c# - 通过WCF服务上传超过50KB的文件失败

asp.net - ValidateRequest 设置为 true 时哪些字符或字符组合无效?

c# - 从数据库读取 GUID 值