This entry is part of a series, Linq to SQL Quirks»
There are a few things that Linq to SQL can be a bit funny about that aren’t so obvious.
First of all, there are what I call implicit inserts. You might not have realised that you don’t actually need to explicitly call InsertOnSubmit on a table for Linq to SQL to do the insert as long as you have created a relationship to an object which already exists in the database. Linq to SQL will automatically insert the new object on the next SubmitChanges call.
Entries in this series:
- Linq to SQL Quirks Part 1: Implicit Inserts
- Linq to SQL Quirks Part 2: DeleteOnSubmit and Entity not Attached
- Linq to SQL Quirks Part 3 - Extension to Get Around the Delete Problem
- Linq to SQL Quirks Part 4: Circular References
No related posts.
Tags: .NET, .NET 3.5, Insert, Linq, Linq to SQL












[...] you use an implicit insert on a new object and then decide that you don’t actually want it, you have a bit of a problem. [...]