I know this question has been asked like 100 times before because I've checked out most of them. None of them seem to work with EF6 though.
Simply, I want to use EF6 to write a record into a SQL Server database, and then recover the value of the Identity column after doing SaveChanges().
Here's my simple program:
using (var ctx = new myEntities())
{
ctx.TinyUrl_Url.Add(new TinyUrl_Url()
{
UrlValue = tinyUrl
});
ctx.SaveChanges();
}
The TinyUrl_Url table has 2 columns: UrlValue, and the Identity PK of UrlID. How can I get the value of UrlID after inserting the new row using EF6?
Thank you.