基本上,实体框架 4.5,c# 4.0。数据库服务器 2008。
我打算创建新记录并将它们插入到表中,但是当我检查数据库时没有任何变化。为什么?
public DbSet<IxDetails> IxDetailRecords { get; set; }
IxContext ixContext = new IxContext();
var list = (from Ix in ixContext.IxDetailRecords
select Ix).ToList();
for (int k = 0; k < 100; k++)
{
IxDetails ix = ixContext.IxDetailRecords.Create();
ix.EnteredBy = "";// current user;
ix.EntryDate = DateTime.Now;
ix.FacilityID = facility;
ix.FirstName = "";
list.Add(ix);
}
ixContext.SaveChanges();