views:

130

answers:

1

hello,

I have web application where Iam using linq to business entites i have business data model.

the problem is :

I have table with one column that it dosen't allow null value, when I try to update this table the folloeing error arise: error The property 'e.g Carrier' is part of the object's key information and cannot be modified

what I can do?

+1  A: 

The easiest thing to do is add a second column to the table that has a unique key eg guid and create a read only property on the entity that corresponds to it.

Linq to business entites needs some kind of key to keep track of what to update in the database. Usually this is the primary key on the database table. If you dont have a primary key it cannot reliably update the database and will then send you an exception.

Also if there is no primary key explicitly set on the table linq to business entites will select one of the columns (think its the first column in the table but i could be wrong) to act as a primary key and will therefore not allow you to update it.

Colin G