Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Is LINQ suitable for tables without primary key? If no then, is it the disadvantage of LINQ?
Posted
Comments
Ankur\m/ 28-Mar-13 5:24am    
I am interested in knowing why your table doesn't have a primary key?
raj_arenem 28-Mar-13 6:00am    
The table just stores the status, either "Fixed" or "Not Fixed" for a particular ID. Like:
MaintainTable->MaintainID, MaintainDetails..., DefectsTable->DefectID, DefectDetails... and the (Table without Primary key) MaintainDefectTable->MaintainID, DefectID, DefectStatus.

I tried to use LINQ, but the values were not getting reflected in the database(MaintainDefectTable). So i arrived at a question, whether LINQ is suitable for such tables.

Thank you.

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900