Exemple #1
0
        public static IUnitOfWorkFactory CreateUnitOfWorkFactory(
            IInterceptUnitOfWork interceptor       = null,
            IAuditConfiguration auditConfiguration = null,
            IDateTime dateTime       = null,
            IUserContext userContext = null)
        {
            var configuration = new EntityFrameworkConfiguration();

            configuration.ConnectionStringName("Persistence");
            configuration.ProviderName(EntityFrameworkConfiguration.SqlServerProviderName);
            configuration.RegisterEntitiesFromAssemblyOf <FooConfiguration>();

            var interceptors = new List <IInterceptUnitOfWork>();

            if (interceptor != null)
            {
                interceptors.Add(interceptor);
            }

            if (auditConfiguration != null)
            {
                interceptors.Add(new EntityFrameworkAuditInterceptor(auditConfiguration, dateTime, userContext));
            }

            return(new EntityFrameworkUnitOfWork.Factory(configuration, interceptors.ToArray(), new ConsoleLogger {
                DebugLoggingIsEnabled = false
            }));
        }
Exemple #2
0
        public static IUnitOfWorkFactory CreateUnitOfWorkFactory(
            IInterceptUnitOfWork interceptor       = null,
            IAuditConfiguration auditConfiguration = null,
            IDateTime dateTime       = null,
            IUserContext userContext = null)
        {
            var configuration = new EntityFrameworkDbContextConfiguration <CompareContext>(connectionStringOrName => new CompareContext(connectionStringOrName));

            configuration.ConnectionStringName("Persistence");

            var interceptors = new List <IInterceptUnitOfWork>();

            if (interceptor != null)
            {
                interceptors.Add(interceptor);
            }

            if (auditConfiguration != null)
            {
                interceptors.Add(new EntityFrameworkAuditInterceptor(auditConfiguration, dateTime, userContext));
            }

            return(new EntityFrameworkUnitOfWork.Factory(configuration, interceptors.ToArray(), new ConsoleLogger {
                DebugLoggingIsEnabled = false
            }));
        }
Exemple #3
0
        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));
        }
 protected override IUnitOfWorkFactory CreateUnitOfWorkFactory(IInterceptUnitOfWork interceptor)
 {
     return(Helper.CreateUnitOfWorkFactory(interceptor));
 }
 protected abstract IUnitOfWorkFactory CreateUnitOfWorkFactory(IInterceptUnitOfWork interceptor);