Пример #1
0
        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)));
        }
Пример #2
0
        public IServantRepository Create(IRepositoryOptions repositoryOptions)
        {
            var database = databaseFactory.Connect(repositoryOptions.ConnectionString, repositoryOptions.DatabaseName);

            return(new ServantRepository(database.GetCollection <Servant>(repositoryOptions.CollectionName)));
        }
Пример #3
0
        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);
 }