在没有主键的情况下在表上使用LINQ。 [英] Using LINQ on Table without the primary key.

查看:92
本文介绍了在没有主键的情况下在表上使用LINQ。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



LINQ是否适合没有主键的表?如果不是,那么它是否是LINQ的缺点?

Hi,
Is LINQ suitable for tables without primary key? If no then, is it the disadvantage of LINQ?

推荐答案

如果你不使用主键,你会失去很多功能。但是,与ADO和其他SQL数据访问组件一样,缺点在于设计表的方式 - 在这种情况下不被访问。



所以,到回答你的问题 - 是的,它是合适的。



但是,你会失去很多很好的功能 - 我的主要关心 - 是对象模型的关系它们在LINQ中自动处理。如果你想要一个不使用LINQ的类似功能,你将不得不使用触发器和存储过程来处理那种自动关系的hanlding。
You would loose a lot of features if you don''t utilise primary keys. However, as with ADO and other SQL Data Access Components, the disadvantage is laying in the way the tables are designed - not accessed, in this case.

So, to answer your question - Yes, it is suitable.

However, you will loose a lot of nice features in your case - of my primary concern - is the object model relationships which are automatically handled in LINQ. If you want a similar feature not using LINQ, you would''ve had to use triggers and stored procedures to handle that kind of ''automatic'' hanlding of relationships.


这篇关于在没有主键的情况下在表上使用LINQ。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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