Home Get output 'inserted' on update with Entity Framework
Reply: 0

Get output 'inserted' on update with Entity Framework

user5989 Published in September 19, 2018, 11:28 am

SQL Server provides output for inserted and updated record with the 'inserted' keyword.

I have a table representing a processing queue. I use the following query to lock a record and get the ID of the locked record:

UPDATE TOP (1) GlobalTrans
OUTPUT inserted.ID

This will output a column named ID with all the updated record IDs (a single ID in my case). How can I translate this into EF in C# to execute the update and get the ID back?

share|improve this question
  • why not use trigger ? Do you connect to mssql database through that unity? – Whencesoever Apr 16 at 13:07
  • 1
    See stackoverflow.com/questions/49859510/… – paparazzo Apr 16 at 14:31

1 Answer 1

active oldest votes
up vote 1 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.341092 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO