Posted by: Matthew | February 4, 2008

Read inserted Id from LINQ entity

LINQ really does require a different mindset at times. I came across the following post when I was trying to find out how to read the Id (Primary Key) of an entity that I had just inserted into the database.

http://blog.jemm.net/articles/databases/how-to-common-data-patterns-with-linq-to-sql/

 The answer is to simply read the property from your entity object directly after calling “SubmitChanges()”:

Read the Id of an entity after insert


Responses

  1. [...] Entity February 6, 2008 14:19 by Admin How do you get the inserted ID from a LINQ Entity?  Read the Id property… Be the first to rate this postCurrently 0/5 Stars.12345 Tags: Categories: c# | recipe Actions: [...]

  2. Great. I start to like Linq more and more

  3. It’s realy simply! thanks for information!
    I like LINQ!

  4. Wow, thats really convenient! that simplifies my problem a lot. Thanks!

  5. [...] Read inserted Id from LINQ Tagged with: Linq leave a comment « Convert wav to m4a [...]


Leave a response

Your response:

Categories