public MongoGenericRepository(IMongoCollectionFactory factory, string collectionName)
        {
            Throw.IfNull(factory, nameof(factory));
            Throw.IfNull(collectionName, nameof(collectionName));

            _collection = factory.GetCollection <TMongoEntity>(collectionName);
        }
 public CreatedCityWeatherForecastSearchListener(
     IOptions <HubMethods> options,
     IHubContext <WeatherHistoryHub> hubContext,
     IMongoCollectionFactory <WeatherHistoryConnection> mongoCollectionFactory)
 {
     _hubMethods = options.Value;
     _hubContext = hubContext;
     _weatherHistoryConnectionCollection = mongoCollectionFactory.Create();
 }
Esempio n. 3
0
        public MongoContext(IMongoConfigurationFactory configurationFactory,
                            IMongoClientFactory clientFactory,
                            IMongoDatabaseFactory databaseFactory,
                            IMongoCollectionFactory <Question> questionCollectionFactory,
                            IMongoCollectionFactory <Answer> answerCollectionFactory,
                            IMongoCollectionFactory <SearchTerm> searchTermCollectionFactory)
        {
            this.configurationFactory        = configurationFactory;
            this.clientFactory               = clientFactory;
            this.databaseFactory             = databaseFactory;
            this.questionCollectionFactory   = questionCollectionFactory;
            this.answerCollectionFactory     = answerCollectionFactory;
            this.searchTermCollectionFactory = searchTermCollectionFactory;

            configuration = configurationFactory.Create();
            var client = clientFactory.Create(configuration);

            database = databaseFactory.GetDatabase(configuration, client);

            EnforceTextIndexes();
        }
        public CreateIconValidator(IMongoCollectionFactory <IconDocument> mongoCollectionFactory)
        {
            _iconCollection = mongoCollectionFactory.Create();

            RuleFor(c => c.Name)
            .Cascade(CascadeMode.Stop)
            .Must(IsNotNullOrEmptyAndAtLeastOneNonWhiteCharacterLong).WithMessage("{PropertyName} should have at least 1 character that is not a white character")
            .MustAsync(async(name, cancellation) => await IsNameUnique(name, cancellation)).WithMessage("{PropertyName} must be unique");

            RuleFor(c => c.Description)
            .Cascade(CascadeMode.Stop)
            .Must(IsNotNullOrEmptyAndAtLeastOneNonWhiteCharacterLong).WithMessage("{PropertyName} should have at least 1 character that is not a white character");

            RuleFor(c => c.Icon)
            .Cascade(CascadeMode.Stop)
            .Must(IsNotNullOrEmptyAndAtLeastOneNonWhiteCharacterLong).WithMessage("{PropertyName} should have at least 1 character that is not a white character")
            .MustAsync(async(icon, cancellation) => await IsIconUnique(icon, cancellation)).WithMessage("{PropertyName} must be unique");

            RuleFor(c => c.FileContent)
            .Cascade(CascadeMode.Continue)
            .NotNull().WithMessage("{PropertyName} can't be null")
            .NotEmpty().WithMessage("{PropertyName} can't be empty");
        }
Esempio n. 5
0
 public MongoRepository(IMongoCollectionFactory <TMongoDocument> mongoCollectionFactory)
 {
     _mongoCollection = mongoCollectionFactory.Get();
 }
Esempio n. 6
0
 public WorkbenchNodeRepository(IMongoCollectionFactory <WorkbenchNode> nodeCollectionFactory)
 {
     MongoCollection = nodeCollectionFactory.GetMongoCollection(collectionName);
 }
Esempio n. 7
0
 public WeatherHistoryHub(IMongoCollectionFactory <WeatherHistoryConnection> mongoCollectionFactory)
 {
     _weatherHistoryConnectionCollection = mongoCollectionFactory.Create();
 }
Esempio n. 8
0
 public MongoDbHandler(IMongoCollectionFactory dbFactory)
 {
     _dbFactory = dbFactory;
 }
Esempio n. 9
0
 public CityWeatherForecastService(IMongoCollectionFactory <CityWeatherForecastDocument> mongoCollectionFactory)
 {
     _cityWeatherForecastCollection = mongoCollectionFactory.Create();
 }