我在 VS 2012 中使用 EF 5。我正在尝试将新记录保存到表中,但没有保存在表中,也没有引发错误。请帮忙 。我附上我的代码。
using (TestEntities context = new TestEntities(new TestEntityConnectionManager("Testconn").ConnectionString))
{
var newCan = new Can
{
CanGUID = new Guid(canGuid),
CanName = canName,
CanDescription = canDescription,
DesignCandidateID = designCandidateId,
MigrationDataXml = migrationDataXml,
PersonID = 1,
LastModifiedPersonID = 1,
CreationDate = DateTime.Now,
LastModifiedDate = DateTime.Now,
};
context.Cans.AddObject(newCan);
var paramOut = context.SaveChanges();
retval = paramOut.ToString();