/// <summary> /// Initializes a new instance of the <see cref="DocumentContextScope" /> class. /// </summary> /// <param name="connectionString">The connection string.</param> /// <param name="repositoryFactory">The <see cref="IDocumentRepositoryFactory" /> factory.</param> public DocumentContextScope(string connectionString, IDocumentRepositoryFactory repositoryFactory = null) { DocumentContextScope.repositoryFactory = repositoryFactory; this.context = new DocumentContext(connectionString); }
/// <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); } }
/// <summary> /// Creates document context scope. /// </summary> /// <param name="connectionString">The connection string.</param> /// <returns> /// The instance of <see cref="T:IDataContextScope" />. /// </returns> public IDocumentContextScope CreateDocumentContextScope(string connectionString) { IDocumentRepositoryFactory repositoryFactory = this.repositoryFactory?.GetFactory <IDocumentRepositoryFactory>(); return(new DocumentContextScope(connectionString, repositoryFactory)); }