在没有主键的MVC中我们可以进行CRUD操作 [英] In MVC with out primary key can we do CRUD operations

查看:90
本文介绍了在没有主键的MVC中我们可以进行CRUD操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这些表中有一个数据库大多数没有主键,但之前在asp.net应用程序开发中使用的是基于连接的查询和存储过程。现在有些部分变成了以前工作的数据库的MVC,可能没有主键表在MVC中工作。如果DB asp.net应用程序中的任何更改没有运行那就是我的问题



我尝试了什么:



我试图插入一个表给它一个错误



无法更新EntitySet'cst_StudentRoll',因为它有一个定义查询而不是< insertfunction>元素存在于< modificationfunctionmapping>中支持当前操作的元素。

i have an DB in that tables Mostly don't have primary keys, but that is used previously in asp.net application development through join based queries and stored procedures. Now some part turn into MVC with previously working DB, is that possible without primary key Table work in MVC. if any changes in DB asp.net application not run that is My problem

What I have tried:

i'm try to insert a table it give me an error

Unable to update the EntitySet 'cst_StudentRoll' because it has a DefiningQuery and no <insertfunction> element exists in the <modificationfunctionmapping> element to support the current operation.

推荐答案

如果你正在使用实体框架,你的表必须有主键。



一般情况下,如果没有它们,您将有更困难的时间唯一地标识表中的每一行以支持CRUD操作。
If you're using Entity Framework your tables MUST HAVE primary keys.

In general, without them you will have a much more difficult time uniquely identifying every row in the table in order to support CRUD operations.


这篇关于在没有主键的MVC中我们可以进行CRUD操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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