Linq to SQL Quirks Part 1: Implicit Inserts

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.

No related posts.

Tags: , , , ,

One Response to “Linq to SQL Quirks Part 1: Implicit Inserts”

  1. [...] 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. [...]

Leave a Reply