I have an object that has a property called ObjectID that maps to the primary key of a table in the DB.
What happens if you do a linq-to-sql insert and attempt to do an insert with an object with an ObjectID already present in the DB?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
after test:
if the entity you trying to insert new to the datacontext even if the primarykey value already exists it will insert a new entity
with new IDif the entity you trying to insert is pulled from the same datacontext then it will throws this exception
Cannot add an entity that already exists.anyway you can try it by yourself to insure this.