public IRepository <TEntity> Create <TEntity>(RepositoryOptions options) { if (options == null) { throw new ArgumentNullException("options"); } var db = _dbFactory.Connect(options.ConnectionString, options.DatabaseName); return(new Repository <TEntity>(db.GetCollection <TEntity>(options.CollectionName))); }
public IServantRepository Create(IRepositoryOptions repositoryOptions) { var database = databaseFactory.Connect(repositoryOptions.ConnectionString, repositoryOptions.DatabaseName); return(new ServantRepository(database.GetCollection <Servant>(repositoryOptions.CollectionName))); }
public IRepositorio <TEntity> Create <TEntity>(RepositorioOptions options) { var db = _dbFactory.Connect(options.ConnectionString, options.DbName); return(new Repositorio <TEntity>(db.GetCollection <TEntity>(options.CollectionName))); }
/// <summary> /// Initializes a new instance of the <see cref="GenericMongoRepository"/> class. /// </summary> /// <param name="databaseFactory">The database factory.</param> /// <param name="optionsAccessor">The options accessor.</param> public GenericMongoRepository(IMongoDatabaseFactory databaseFactory, IOptions <MongoConfigurationOptions> optionsAccessor) { database = databaseFactory.Connect(optionsAccessor); }