示例#1
0
        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>());
        }
示例#2
0
        public SmartSqlMapper(
            ILoggerFactory loggerFactory,
            String sqlMapConfigFilePath
            , IDbConnectionSessionStore sessionStore
            , IDataSourceManager dataSourceManager
            , ICacheManager cacheManager
            , ISqlBuilder sqlBuilder
            , IConfigLoader configLoader
            )
        {
            _loggerFactory              = loggerFactory;
            _logger                     = loggerFactory.CreateLogger <SmartSqlMapper>();
            SqlMapConfig                = ConfigLoader.Load();
            DbProviderFactory           = SqlMapConfig.Database.DbProvider.DbProviderFactory;
            SessionStore                = sessionStore;
            SqlBuilder                  = sqlBuilder;
            DataSourceManager           = dataSourceManager;
            CacheManager                = cacheManager;
            CacheManager.SmartSqlMapper = this;
            _sqlRuner                   = new SqlRuner(loggerFactory, SqlBuilder, this);

            ConfigLoader.OnChanged = SqlConfigOnChanged;
            SqlMapConfig.SetLogger(_loggerFactory.CreateLogger <SmartSqlMapConfig>());
        }