/// <summary>
        /// Creates database context scope.
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="isTransactional">Indicates whether the scope supports transactions.</param>
        /// <returns>
        /// The instance of <see cref="T:IDataContextScope" />.
        /// </returns>
        public IDbContextScope CreateDbContextScope(string connectionString, bool isTransactional = false)
        {
            IDbRepositoryFactory     repositoryFactory     = this.repositoryFactory?.GetFactory <IDbRepositoryFactory>();
            IDbQueryHandlerFactory   queryHandlerFactory   = this.queryHandlerFactory?.GetFactory <IDbQueryHandlerFactory>();
            IDbCommandHandlerFactory commandHandlerFactory = this.commandHandlerFactory?.GetFactory <IDbCommandHandlerFactory>();

            return(new DbContextScope(connectionString, isTransactional, repositoryFactory, queryHandlerFactory, commandHandlerFactory));
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DbContextScope" /> class.
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="isTransactional">Indicates whether the scope should support database transactions.</param>
        /// <param name="repositoryFactory">The <see cref="IDbRepositoryFactory" /> factory.</param>
        /// <param name="queryHandlerFactory">The <see cref="IDbQueryHandlerFactory" /> factory.</param>
        /// <param name="commandHandlerFactory">The <see cref="IDbCommandHandlerFactory" /> factory.</param>
        public DbContextScope(string connectionString, bool isTransactional, IDbRepositoryFactory repositoryFactory = null, IDbQueryHandlerFactory queryHandlerFactory = null, IDbCommandHandlerFactory commandHandlerFactory = null)
        {
            DbContextScope.repositoryFactory     = repositoryFactory;
            DbContextScope.queryHandlerFactory   = queryHandlerFactory;
            DbContextScope.commandHandlerFactory = commandHandlerFactory;

            this.context = new DbContext(connectionString, isTransactional);
        }
Пример #3
0
 public DataCopy(ISchemaReader schemaReader, ISchemaConverter schemaConverter, IDbRepositoryFactory repositoryFactory, ITableBulkCopy tableBulkCopy, IEnumerable<IEntityFilter> entityFilters, IEntityTableFactory entityTableFactory)
 {
     _schemaReader = schemaReader;
     _schemaConverter = schemaConverter;
     _repositoryFactory = repositoryFactory;
     _entityFilters = entityFilters;
     _tableBulkCopy = tableBulkCopy;
     _entityTableFactory = entityTableFactory;
 }
Пример #4
0
 public DataCopy(ISchemaReader schemaReader, ISchemaConverter schemaConverter, IDbRepositoryFactory repositoryFactory, ITableBulkCopy tableBulkCopy, IEnumerable <IEntityFilter> entityFilters, IEntityTableFactory entityTableFactory)
 {
     _schemaReader       = schemaReader;
     _schemaConverter    = schemaConverter;
     _repositoryFactory  = repositoryFactory;
     _entityFilters      = entityFilters;
     _tableBulkCopy      = tableBulkCopy;
     _entityTableFactory = entityTableFactory;
 }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryFactory" /> class.
        /// </summary>
        /// <param name="databaseRepositoryFactory">The <see cref="IDbRepositoryFactory" /> factory.</param>
        /// <param name="documentRepositoryFactory">>The <see cref="IDocumentRepositoryFactory" /> factory.</param>
        public RepositoryFactory(IDbRepositoryFactory databaseRepositoryFactory = null, IDocumentRepositoryFactory documentRepositoryFactory = null)
        {
            if (databaseRepositoryFactory != null)
            {
                this.container.Add(typeof(IDbRepositoryFactory), databaseRepositoryFactory);
            }

            if (documentRepositoryFactory != null)
            {
                this.container.Add(typeof(IDocumentRepositoryFactory), documentRepositoryFactory);
            }
        }