DataContext.GetChangeSet方法 (得到改变内容的行)

DataContext.GetChangeSe方法 (得到改变内容的行)

System.Data.Linq.ChangeSet cs =DataContext.GetChangeSet()

将得DataContext中所有表的改变内容的行,具体是那个表的,还要筛选一下

添加的行

LinqTestDBDataContext a;

a = new LinqTestDBDataContext("Data Source=.;Initial Catalog=LinqTestDB;Integrated Security=True");

System.Collections.Generic.IList<object> o = a.GetChangeSet().AddedEntities;

删除的行

LinqTestDBDataContext a;

a = new LinqTestDBDataContext("Data Source=.;Initial Catalog=LinqTestDB;Integrated Security=True");

System.Collections.Generic.IList<object> o = a.GetChangeSet().RemovedEntities;

修改的行

LinqTestDBDataContext a;

a = new LinqTestDBDataContext("Data Source=.;Initial Catalog=LinqTestDB;Integrated Security=True");

System.Collections.Generic.IList<object> o = a.GetChangeSet().ModifiedEntities;

posted @ 2012-08-28 13:57  zhcnblog  阅读(439)  评论(0编辑  收藏  举报