【发布时间】:2014-09-27 22:08:23
【问题描述】:
我正在使用对象初始化器将数据插入到使用实体框架的表中。数据完美地保存到数据库中,但我想从该表中检索身份。
这是我的代码:-
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();
但我不知道如何从该表中检索身份??
【问题讨论】:
标签: c# entity-framework