简单数据操作

通过DBContext对象的静态方法可以进行一些简单的数据操作.
  • 添加数据
AccountState Aitem = new AccountState();
Aitem.ModifyTime = DateTime.Now;
Aitem.State = OnlineState.在线;
Aitem.IPAddress = e.Point.Address.ToString();
Aitem.AccountID = e.ID;
DBContext.Save(Aitem);
  • 修改数据
account = Smark.Data.DBContext.Load<Accounts>(channel.Account);
amount += untis * fee.Price;
account.Amount = account.Amount - amount;
Smark.Data.DBContext.Save(account);
  • 删除数据
Smark.Data.DBContext.Delete<Accounts>(id);

Last edited Jun 4, 2010 at 10:18 AM by smarkhenry, version 1

Comments

No comments yet.