public static IUnitOfWorkFactory CreateUnitOfWorkFactory( IInterceptUnitOfWork interceptor = null, IAuditConfiguration auditConfiguration = null, IDateTime dateTime = null, IUserContext userContext = null) { var logger = new ConsoleLogger { DebugLoggingIsEnabled = false }; var databaseConfigurer = new SqlServerDatabaseConfigurer() .ConnectionStringName("Persistence"); var mapperConfigurer = new ByCodeMapperConfigurer() .RegisterEntitiesFromAssembly(Assembly.GetExecutingAssembly()); var configuration = new NHibernateConfiguration(logger); configuration.RegisterConfigurer(databaseConfigurer); configuration.RegisterConfigurer(mapperConfigurer); configuration.RegisterConfigurer(new ProxyConfigurer <CastleProxyFactoryFactory>()); IInterceptUnitOfWork[] interceptors = null; if (interceptor != null) { interceptors = new[] { interceptor }; } return(new NHibernateUnitOfWork.Factory(configuration, interceptors, auditConfiguration, dateTime, userContext, logger)); }
public void CompareByCodeSchema() { var subSetConnectionString = ConfigurationManager.ConnectionStrings["PersistenceNHByCode"].ConnectionString; var databaseConfigurer = new SqlServerDatabaseConfigurer() .ConnectionString(subSetConnectionString); var mapperConfigurer = new ByCodeMapperConfigurer() .RegisterEntitiesFromAssembly(Assembly.GetExecutingAssembly()) .RegisterConvention <NHibernate.Configuration.ByCode.Conventions.DateTime2Convention>(); this.CompareSchema( subSetConnectionString, databaseConfigurer, mapperConfigurer, new ProxyConfigurer <CastleProxyFactoryFactory>()); }
public void CompareFluentAutoMapSchema() { var subSetConnectionString = ConfigurationManager.ConnectionStrings["PersistenceNHFluentAuto"].ConnectionString; var databaseConfigurer = new SqlServerDatabaseConfigurer() .ConnectionString(subSetConnectionString); var mapperConfigurer = new FluentAutoMapperConfigurer() .AutoMappingConfiguration(new SQLiteAtlasAutoMappingConfiguration()) .AutoMapEntitiesFromAssembly(Assembly.GetExecutingAssembly()) .RegisterConvention <NHibernate.Configuration.Fluent.Conventions.PropertyConvention>() .RegisterConvention <NHibernate.Configuration.Fluent.Conventions.DateTime2Convention>() .RegisterConvention <NHibernate.Configuration.Fluent.Conventions.VersionConvention>() .RegisterConvention <NHibernate.Configuration.Fluent.Conventions.XElementConvention>(); this.CompareSchema( subSetConnectionString, databaseConfigurer, mapperConfigurer, new ProxyConfigurer <CastleProxyFactoryFactory>()); }