动态数据:对于使用视图而不是表的 LINQ 类,支架是只读的?
我正在尝试使用 ASP.NET 动态数据功能为我的数据模型生成 CRUD 脚手架。 我的模型包含超类型/子类型关系,因此一些逻辑实体分为两个表:一张用于通用数据,一张用于特定于子类型的数据。
在 LINQ 上下文中,我将这些实体公开为单个类,并由将表连接在一起的视图支持。 我还为插入/更新/删除创建了存储过程,并配置了类行为以使用它们。
当我打开脚手架时,它仅生成此数据的只读视图。 添加、编辑和删除链接不会显示。 为什么?
I am trying to use the ASP.NET Dynamic Data features to generate CRUD scaffolding for my data model. My model contains supertype/subtype relationships, so some logical entities are split between two tables: one for the generic data and one for the subtype-specific data.
In the LINQ context I expose these entities as a single class, backed by a view that joins the tables together. I have also created sprocs for insert/update/delete and configured the class behaviour to use them.
When I turn on scaffolding, it only generates a read-only view of this data. The add, edit and remove links don't show up. Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决:问题是在将视图拖到表面上后,我没有识别 LINQ 类上的主键列。 添加 PK 后,CRUD 功能就出现了。
SOLVED: The problem was that I did not identify a Primary Key column on the LINQ classes after dragging the views onto the surface. After adding a PK the CRUD functions showed up.