标签:
最近考虑到并发的问题,用 EF 处理并发非常麻烦, 直接用原生SQL简单:
Database.ExecuteSqlCommand:不用返回结果,比如Update等等,
Database.SqlQuery<T>:返回结果,比如查询
例:
db.Database.ExecuteSqlCommand("update tbMemberAccount set Sum_Recharge=Sum_Recharge+{0},Left_ECurrency=Left_ECurrency+{0},Update_Time={1}",
memberRechargeView.Money, DateTime.Now); db.Database.SqlQuery<tbMemberAccount>("select * from tbMemberAccount where Member_ID={0}", query.Member_ID);
标签:
原文地址:http://www.cnblogs.com/tider1999/p/4420383.html