LINQ to SQL添加主键 [英] LINQ to SQL adding primary keys

查看:170
本文介绍了LINQ to SQL添加主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在对象关系设计器中向表中添加主键,它是否会修改我引用的数据库中的同一个表?我只想查询数据,没有更新或删除。我根本不想修改数据库中的表。只需选择。

If i add a primary key to a table in the Object Relational Designer, will it in turn modify the same table in the database i am referencing?  I only want to query for data, no updates or deletes.  I do not want to modify the tables in the database at all.   Just select.

推荐答案

否.. LINQ不会修改数据库结构的任何内容。
如果你改变(在dbml文件中)"主键",字段的属性为True,该字段将被解释为主键,让您执行插入,更新和删除

No.. LINQ will not modify anything of the structure of your database.
If you change (in the dbml file) the "Primary Key" property of a field to True, that field will be interpreted like a primary key, letting you perform Inserts, Updates and Deletes


这篇关于LINQ to SQL添加主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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