public EntityFrameworkUnitOfWorkFactory(IConfiguration configuration, IDbContextFactory contextFactory, IDbConfiguration dbConfiguration)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");
            if (contextFactory == null) throw new ArgumentNullException("contextFactory");
            if (dbConfiguration == null) throw new ArgumentNullException("dbConfiguration");

            _configuration = configuration;
            _contextFactory = contextFactory;
            _dbConfiguration = dbConfiguration;
            _contextType = null;
        }
        public EntityFrameworkUnitOfWorkFactory(
            IConfiguration configuration,
            IDbContextFactory contextFactory,
            IDbConfiguration dbConfiguration,
            IEntityFrameworkRepositoryLogger logger) : this(logger)
        {
            if (configuration == null) throw new ArgumentNullException(nameof(configuration));
            if (contextFactory == null) throw new ArgumentNullException(nameof(contextFactory));
            if (dbConfiguration == null) throw new ArgumentNullException(nameof(dbConfiguration));

            _configuration = configuration;
            _contextFactory = contextFactory;
            _dbConfiguration = dbConfiguration;
            _contextType = null;
        }
        public EntityFrameworkUnitOfWorkFactory(
            string contextType,
            string connectionString,
            IDbConfiguration dbConfiguration)
        {
            if (String.IsNullOrWhiteSpace(contextType)) throw new ArgumentNullException("contextType");
            if (String.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullException("connectionString");
            if (dbConfiguration == null) throw new ArgumentNullException("dbConfiguration");


            _contextType = Type.GetType(contextType);
            _connectionString = connectionString;
            _dbConfiguration = dbConfiguration;

            if (_contextType == null)
            {
                throw new InvalidOperationException(String.Format("Unable to locate context type {0}", _contextType));
            }
        }
        public EntityFrameworkUnitOfWorkFactory(
            string contextType,
            string connectionString,
            IDbConfiguration dbConfiguration,
            IEntityFrameworkRepositoryLogger logger) : this(logger)
        {
            if (String.IsNullOrWhiteSpace(contextType)) throw new ArgumentNullException(nameof(contextType));
            if (String.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullException(nameof(connectionString));
            if (dbConfiguration == null) throw new ArgumentNullException(nameof(dbConfiguration));

            _contextType = Type.GetType(contextType);
            _connectionString = connectionString;
            _dbConfiguration = dbConfiguration;

            if (_contextType == null)
            {
                // deliberately not logged as an error as this throws an exception - it is for the callee to decide
                // if this is an error
                _logger?.Verbose("EntityFrameworkUnitOfWorkFactory: Unable to locate context type {0}", _contextType);
                throw new InvalidOperationException($"Unable to locate context type {_contextType}");
            }
        }
 public EntityFrameworkUnitOfWorkFactoryProvider(IDbConfiguration dbConfiguration, IEntityFrameworkRepositoryLogger logger)
 {
     _dbConfiguration = dbConfiguration;
     _logger = logger;
 }
コード例 #6
0
 public ConnectionProvider(IDbConfiguration dbConfiguration)
 {
     DbConfiguration = dbConfiguration;
 }
 public EntityFrameworkUnitOfWorkFactoryProvider(IDbConfiguration dbConfiguration)
 {
     _dbConfiguration = dbConfiguration;
 }
コード例 #8
0
 public UnitOfWork(IDbConfiguration configuration)
 {
     _context = new Context(configuration);
 }
コード例 #9
0
 public Context(IDbConfiguration configuration)
     : base(configuration.ConnectionString)
 {
 }