public CreatedCityWeatherForecastSearchListener(
     IOptions <HubMethods> options,
     IHubContext <WeatherHistoryHub> hubContext,
     IMongoCollectionFactory <WeatherHistoryConnection> mongoCollectionFactory)
 {
     _hubMethods = options.Value;
     _hubContext = hubContext;
     _weatherHistoryConnectionCollection = mongoCollectionFactory.Create();
 }
        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");
        }
示例#3
0
 public WeatherHistoryHub(IMongoCollectionFactory <WeatherHistoryConnection> mongoCollectionFactory)
 {
     _weatherHistoryConnectionCollection = mongoCollectionFactory.Create();
 }
示例#4
0
 public CityWeatherForecastService(IMongoCollectionFactory <CityWeatherForecastDocument> mongoCollectionFactory)
 {
     _cityWeatherForecastCollection = mongoCollectionFactory.Create();
 }