コード例 #1
0
        private FluentConfiguration GetConfiguration(bool showSql = false)
        {
            var cfg = new AutoMappingConfiguration();

            var mapping = AutoMap.AssemblyOf <Sample>(cfg)
                          .IgnoreBase <BaseModel>()
                          .Conventions.Add(_mappingConventions.ToArray());

            var msSqlConfiguration = MsSqlConfiguration.MsSql2008.ConnectionString(_settings.ConnectionString);

            if (showSql)
            {
                msSqlConfiguration = msSqlConfiguration.ShowSql();
            }

            return(Fluently.Configure()
                   .ExposeConfiguration(x =>
            {
                x.SetProperty("current_session_context_class", _settings.CurrentSessionContextClass);
                x.SetProperty("connection.isolation", IsolationLevel.ReadUncommitted.ToString());
                x.SetProperty("default_schema", _settings.DefaultSchema);
                x.SetProperty("cache.use_query_cache", "true");
                x.SetProperty("adonet.batch_size", _settings.AdonetBatchSize);
            })
                   .Database(msSqlConfiguration)
                   .Mappings(m => m.AutoMappings.Add(mapping)));
        }
コード例 #2
0
        private FluentConfiguration GetConfiguration(bool showSql = false)
        {
            var cfg = new AutoMappingConfiguration();

            var mapping = AutoMap.AssemblyOf<Sample>(cfg)
                .IgnoreBase<BaseModel>()
                .Conventions.Add(_mappingConventions.ToArray());

            var msSqlConfiguration = MsSqlConfiguration.MsSql2008.ConnectionString(_settings.ConnectionString);
            if (showSql) msSqlConfiguration = msSqlConfiguration.ShowSql();

            return Fluently.Configure()
                .ExposeConfiguration(x =>
                {
                    x.SetProperty("current_session_context_class", _settings.CurrentSessionContextClass);
                    x.SetProperty("connection.isolation", IsolationLevel.ReadUncommitted.ToString());
                    x.SetProperty("default_schema", _settings.DefaultSchema);
                    x.SetProperty("cache.use_query_cache", "true");
                    x.SetProperty("adonet.batch_size", _settings.AdonetBatchSize);
                })
                .Database(msSqlConfiguration)
                .Mappings(m => m.AutoMappings.Add(mapping));
        }