日期:2014-05-17 浏览次数:20837 次
ISession session = new Session(DBString);
//查询并且分页
Source s = session.Select(typeof(Source).Name).Skip(1, 1, Source.IDProty).ExecuteDataTable<Source>().First();
//删除
session.Delete(typeof(Source).Name).AddWhere(Source.IDProty, s.ID, WhereEnum.等于);
s.Title = "10000000000";
//修改
session.Update(typeof(Source).Name, s);
//添加
ISession sessions = new Session(DBString);
sessions.Insert(typeof(Source).Name, s);
ITransaction transactio = new Transaction();
//删除和添加操作放到了一起做事务
transactio.SetOperation(session);
transactio.SetOperation(sessions);
//事务
System.Console.WriteLine(transactio.Execute().ToString());
System.Console.WriteLine("Over");
System.Console.ReadLine();