Example #1
0
 /// <summary>
 /// 初始化仓储
 /// </summary>
 /// <param name="_con">数据库连接串</param>
 /// <param name="repoXmlProvider"></param>
 /// <param name="exceptionHandler">抛错时的委托</param>
 /// <param name="throws">是否抛出错误,强烈建议保持默认值 true 不然报错时会返回正常数据。</param>
 public RepositoryBase(IDbConnection _con, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true)
 {
     con              = _con;
     RepoXmlProvider  = repoXmlProvider;
     ExceptionHandler = exceptionHandler;
     Throws           = throws;
 }
 /// <summary>
 /// 暂时不让随便 new
 /// </summary>
 /// <param name="_con">数据库连接</param>
 /// <param name="repoXmlProvider">xml查询语句提供器</param>
 /// <param name="exceptionHandler">错误事件</param>
 /// <param name="throws">是否抛出错误</param>
 protected TransactionProviderBase(IDbConnection _con, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true)
 {
     Connection = _con;
     if (Connection.State == ConnectionState.Closed)
     {
         Connection.Open();
     }
     Transaction        = _con.BeginTransaction();
     RepoXmlProvider    = repoXmlProvider;
     ExExceptionHandler = exceptionHandler;
     Throws             = throws;
 }
Example #3
0
 /// <summary>
 /// 初始化仓储
 /// </summary>
 /// <param name="connectionString">数据库连接串</param>
 /// <param name="repoXmlProvider"></param>
 /// <param name="exceptionHandler">抛错时的委托</param>
 /// <param name="throws">是否抛出错误,强烈建议保持默认值 true 不然报错时会返回正常数据。</param>
 public RepositoryMysql(string connectionString, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true)
     : base(new MySqlConnection(connectionString), repoXmlProvider, exceptionHandler, throws)
 {
 }
Example #4
0
 /// <summary>
 /// 初始化仓储
 /// </summary>
 /// <param name="connectionHolder"></param>
 /// <param name="repoXmlProvider"></param>
 /// <param name="exceptionHandler"></param>
 /// <param name="throws"></param>
 public RepositoryBase(IConnectionHolder connectionHolder, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true)
     : this(connectionHolder.Connection, repoXmlProvider, exceptionHandler, throws)
 {
     ConnectionHolder = connectionHolder;
 }
Example #5
0
 /// <summary>
 /// 初始化仓储
 /// </summary>
 /// <param name="_con"></param>
 /// <param name="repoXmlProvider"></param>
 /// <param name="exceptionHandler"></param>
 /// <param name="throws"></param>
 /// <param name="_tran"></param>
 protected RepositoryBase(IDbConnection _con, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true, IDbTransaction _tran = null)
     : this(_con, repoXmlProvider, exceptionHandler, throws)
 {
     DbTransaction = _tran;
 }
Example #6
0
 /// <summary>
 /// 不让随便 new
 /// </summary>
 /// <param name="_con"></param>
 internal TransactionProviderMysql(IDbConnection _con, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true)
     : base(_con, repoXmlProvider, exceptionHandler, throws)
 {
 }
Example #7
0
 public RepositoryMsSql(IDbConnection _con, RepoXmlProvider repoXmlProvider = null, SqlEx.Core.Core.SqlExExceptionHandler exceptionHandler = null, bool throws = true)
     : base(_con, repoXmlProvider, exceptionHandler, throws)
 {
 }