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.

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

Read the Id of an entity after insert

About these ads


  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 […]

  6. this was my problem since a long time. This is a great post. Thanks a lot Matthew.

  7. Gracias Amigo!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



Get every new post delivered to your Inbox.

%d bloggers like this: