public Configuration BuildConfiguration <TDriver, TDialect, TContext>(BaseMapping mapping, String connectionStringName, Boolean updateSchema = false) where TDriver : IDriver where TDialect : Dialect where TContext : ICurrentSessionContext { return(this.BuildConfiguration <TDriver, TDialect, TContext, IBatcherFactory>(mapping, connectionStringName, updateSchema)); }
public override Configuration BuildConfiguration <TDriver, TDialect, TContext, TBatcherFactory>(BaseMapping mapping, String connectionStringName, Boolean updateSchema = false) { Configuration cfg = this.CreateConfiguration() .Configure(); if (updateSchema == true) { SchemaExport export = new SchemaExport(cfg); export.Create(true, true); } return(cfg); }
public abstract Configuration BuildConfiguration <TDriver, TDialect, TContext, TBatcherFactory>(BaseMapping mapping, String connectionStringName, Boolean updateSchema = false) where TDriver : IDriver where TDialect : Dialect where TContext : ICurrentSessionContext where TBatcherFactory : IBatcherFactory;
public Configuration BuildConfiguration(Type driverType, Type dialectType, Type contextType, Type batcherFactoryType, BaseMapping mapping, String connectionStringName, Boolean updateSchema = false) { if (driverType == null) { driverType = typeof(IDriver); } if (dialectType == null) { dialectType = typeof(Dialect); } if (contextType == null) { contextType = typeof(ICurrentSessionContext); } if (batcherFactoryType == null) { batcherFactoryType = typeof(NonBatchingBatcherFactory); } return(ReflectionHelper.GetMethod <BaseConfiguration>(x => x.BuildConfiguration <IDriver, Dialect, ICurrentSessionContext, IBatcherFactory>(null, null, false)).MakeGenericMethod(driverType, dialectType, contextType, batcherFactoryType).Invoke(this, new Object[] { mapping, connectionStringName, updateSchema }) as Configuration); }
public override Configuration BuildConfiguration <TDriver, TDialect, TContext, TBatcherFactory>(BaseMapping mapping, String connectionStringName, Boolean updateSchema = false) { Configuration cfg = this.CreateConfiguration() .DataBaseIntegration(db => { db.ConnectionStringName = connectionStringName; db.Dialect <TDialect>(); db.Driver <TDriver>(); db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'"; db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote; db.SchemaAction = (updateSchema == true) ? SchemaAutoAction.Update : SchemaAutoAction.Validate; db.LogFormattedSql = true; db.BatchSize = 100; if (typeof(TBatcherFactory) != typeof(IBatcherFactory)) { db.Batcher <TBatcherFactory>(); } }) .SetProperty(NHibernate.Cfg.Environment.WrapResultSets, Boolean.TrueString) .SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, Boolean.FalseString) .SetProperty(NHibernate.Cfg.Environment.QueryStartupChecking, Boolean.TrueString) .SetProperty(NHibernate.Cfg.Environment.PrepareSql, Boolean.TrueString); if (typeof(TContext) != typeof(ICurrentSessionContext)) { cfg = cfg.CurrentSessionContext <TContext>(); } cfg = mapping.Map(cfg); return(cfg); }