IgnoreErrorColumns : IDemos { public void Init() { Console.WriteLine(); using (var db = SugarDao.GetInstance()) { db.IsIgnoreErrorColumns = true; id= db.Insert<STUDENT>(, AreaName = }); db.Update<STUDENT>(, AreaName = }); } } public class STUDENT { Desc:- /// Default:- /// Nullable:False id { get; set; } Desc:- /// Default:- /// Nullable:True name { get; set; } Desc:ѧУID /// Default:- /// Nullable:True ? sch_id { get; set; } Desc:- /// Default:- /// Nullable:True sex { get; set; } Desc:- /// Default:- /// Nullable:True Boolean? isOk { get; set; } public string SchoolName { get; set; } public string AreaName { get; set; } public string SubjectName { get; set; } } }
View Code14¡¢ÊÂÎñ
using System; using System.Collections.Generic; using System.Linq; using System.Text; using NewTest.Dao; using Models; using System.Data.SqlClient; using SqlSugar; namespace NewTest.Demos { Tran : IDemos { public void Init() { Console.WriteLine(); using (SqlSugarClient db = SugarDao.GetInstance())//¿ªÆôÊý¾Ý¿âÁ¬½Ó { db.IsNoLock = true;//ÆôÓÃÎÞËø²éѯ db.CommandTimeOut = { db.BeginTran();//¿ªÆôÊÂÎñ //db.BeginTran(IsolationLevel.ReadCommitted);+3ÖØÔØ¿ÉÒÔÉèÖÃÊÂÊÀ¸ôÀ뼶±ð db.CommitTran();//Ìá½»ÊÂÎñ } catch (Exception) { db.RollbackTran();; } } } } }
View Code15¡¢Á÷Ë®ºÅ¹¦ÄÜ
¡¡