Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm not sure if this goes here or on Stack Overflow, but I figure someone here might know it.

Why did the developers of LINQ decide that not only do you need

ctx.InsertOnSubmit(item);

but you also need

ctx.Items.SubmitChanges();

Did they do this so you could execute several queries on one trip to the database or am I missing something?

share|improve this question

1 Answer 1

I'm not 100% sure about LINQ but i would say that the seperation is based on transaction control. You apply any number of updates, inserts or deletes. That are then held as a unit of work, then once you've finished your changes you simply commit them to the database as a single action or roll all of the changes back, maintaining the integrity of your database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.