Exemple #1
0
 public SmartSqlMapper(String sqlMapConfigFilePath, IConfigLoader configLoader)
 {
     ConfigLoader = configLoader;
     ConfigLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore      = new DbConnectionSessionStore(this.GetHashCode().ToString());
     SqlBuilder        = new SqlBuilder(this);
     DataSourceManager = new DataSourceManager(this);
     CacheManager      = new CacheManager(this);
     _sqlRuner         = new SqlRuner(SqlBuilder, this);
 }
        public SmartSqlMapper(ILoggerFactory loggerFactory, String sqlMapConfigFilePath, IConfigLoader configLoader)
        {
            _loggerFactory    = loggerFactory;
            _logger           = loggerFactory.CreateLogger <SmartSqlMapper>();
            ConfigLoader      = configLoader;
            SqlMapConfig      = ConfigLoader.Load();
            DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
            SessionStore      = new DbConnectionSessionStore(loggerFactory, this.GetHashCode().ToString());
            SqlBuilder        = new SqlBuilder(loggerFactory, this);
            DataSourceManager = new DataSourceManager(loggerFactory, this);
            CacheManager      = new CacheManager(loggerFactory, this);
            _sqlRuner         = new SqlRuner(loggerFactory, SqlBuilder, this);

            ConfigLoader.OnChanged = SqlConfigOnChanged;
            SqlMapConfig.SetLogger(_loggerFactory.CreateLogger <SmartSqlMapConfig>());
        }
Exemple #3
0
 public SmartSqlMapper(
     ILoggerFactory loggerFactory,
     String sqlMapConfigFilePath = "SmartSqlMapConfig.xml"
     )
 {
     _loggerFactory = loggerFactory;
     _logger        = loggerFactory.CreateLogger <SmartSqlMapper>();
     ConfigLoader   = new LocalFileConfigLoader(loggerFactory);
     ConfigLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore      = new DbConnectionSessionStore(loggerFactory, this.GetHashCode().ToString());
     SqlBuilder        = new SqlBuilder(loggerFactory, this);
     DataSourceManager = new DataSourceManager(loggerFactory, this);
     CacheManager      = new CacheManager(loggerFactory, this);
     _sqlRuner         = new SqlRuner(loggerFactory, SqlBuilder, this);
 }
Exemple #4
0
 public SmartSqlMapper(
     String sqlMapConfigFilePath
     , IDbConnectionSessionStore sessionStore
     , IDataSourceManager dataSourceManager
     , ICacheManager cacheManager
     , ISqlBuilder sqlBuilder
     , IConfigLoader configLoader
     )
 {
     configLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore      = sessionStore;
     SqlBuilder        = sqlBuilder;
     DataSourceManager = dataSourceManager;
     CacheManager      = cacheManager;
     _sqlRuner         = new SqlRuner(SqlBuilder, this);
 }
Exemple #5
0
 public SmartSqlMapper(
     ILoggerFactory loggerFactory,
     String sqlMapConfigFilePath
     , IDbConnectionSessionStore sessionStore
     , IDataSourceManager dataSourceManager
     , ICacheManager cacheManager
     , ISqlBuilder sqlBuilder
     , IConfigLoader configLoader
     )
 {
     _loggerFactory = loggerFactory;
     _logger        = loggerFactory.CreateLogger <SmartSqlMapper>();
     configLoader.Load(sqlMapConfigFilePath, this);
     DbProviderFactory           = SqlMapConfig.Database.DbProvider.DbProviderFactory;
     SessionStore                = sessionStore;
     SqlBuilder                  = sqlBuilder;
     DataSourceManager           = dataSourceManager;
     CacheManager                = cacheManager;
     CacheManager.SmartSqlMapper = this;
     _sqlRuner = new SqlRuner(loggerFactory, SqlBuilder, this);
 }