I am using Object initializer to insert data into table using Entity Framework. Data is saving into database perfectly , but i want to retrieve the Identity from that table .
Here is my code :-
db.CMSQUEs.Add(new CMSQUE
{
queedfcodequestiontype = questionEdfValue.ToString(),
quenotes = model.QuestionDescription,
queisexternaltext = false,
quenumofoptions = model.NoofOptions,
queusmrefidcreatedby = Convert.ToInt32(System.Web.HttpContext.Current.Session["usmrefid"]),
quescore = model.QuestionScore / model.NoofQuestions,
quetime = model.QuestionDuration
});
db.SaveChanges();
But I don't know how to retrieve the Identity from that table ??