public CartHandler(ILiteDbContext liteDbContext, IProductHandler productHandler)
 {
     _liteDatabase    = liteDbContext.Database;
     _cartsCollection = _liteDatabase.GetCollection <Cart>("carts");
     _cartsCollection.EnsureIndex(x => x.CartId);
     _productHandler = productHandler;
 }
Beispiel #2
0
 public ScraperQueue(ILogger <ScraperQueue> logger, ILiteDbContext context, IMapper mapper, IServiceProvider provider)
 {
     _logger   = logger;
     _db       = context.Database;
     _mapper   = mapper;
     _provider = provider;
 }
Beispiel #3
0
 public LiteDbDbSet(ILiteDbContext context)
 {
     this.context = context;
     this.context.OnDatabaseDisposed += (s, e) =>
     {
         this.collection = null;
     };
 }
 public DatabaseInitializer(
     ILiteDbContext context,
     UserManager <ApplicationUser> userManager,
     RoleManager <IdentityRole> roleManager)
 {
     _context     = context;
     _userManager = userManager;
     _roleManager = roleManager;
 }
Beispiel #5
0
        public UserEditValidator(ILiteDbContext dbContext)
        {
            _db = dbContext.Database;

            RuleFor(x => x.Id).NotEmpty().WithMessage("Nav norādīts Id")
            .DependentRules(() =>
            {
                RuleFor(x => x.Email)
                .Cascade(CascadeMode.StopOnFirstFailure)
                .NotEmpty().WithMessage("Nav norādīta E-pasta adrese")
                .Must(EmailMustUnique).WithMessage("Lietotājs ar šādu e-pasta adresi jau eksistē");
            });
        }
        public UserCreateValidator(ILiteDbContext dbContext)
        {
            _db = dbContext.Database;

            RuleFor(x => x.Email)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .NotEmpty().WithMessage("Nav norādīta E-pasta adrese")
            .Must(EmailMustUnique).WithMessage("Lietotājs ar šādu e-pasta adresi jau eksistē");
            RuleFor(x => x.Password)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .NotEmpty().WithMessage("Nav norādīta Parole")
            .Custom((parole, context) =>
            {
                if (!string.IsNullOrEmpty(parole))
                {
                    if (parole.Length < 9)
                    {
                        context.AddFailure("Parolei jābūt vismaz 9 simbolus garai");
                    }
                    if (!Regex.IsMatch(parole, @"[0-9]+(\.[0-9][0-9]?)?"))
                    {
                        context.AddFailure("Parolē jābūt vismaz vienam ciparam");
                    }
                    if (!Regex.IsMatch(parole, @"^(?=.*[a-z]).+$"))
                    {
                        context.AddFailure("Parolē jābūt vismaz vienam mazajam burtam");
                    }
                    if (!Regex.IsMatch(parole, @"^(?=.*[A-Z]).+$"))
                    {
                        context.AddFailure("Parolē jābūt vismaz vienam lielajam burtam");
                    }
                    if (!Regex.IsMatch(parole, @"[.,!,@,#,$,%,^,&,*,?,_,~,-,£,(,)]"))
                    {
                        context.AddFailure("Parolē jābūt vismaz vienam speciālajam simbolam");
                    }
                }
            });
        }
 public LiteDbReservationRepository(ILiteDbContext liteDbContext) : base(liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }
 public LiteDbUserStore(ILiteDbContext dbContext)
 {
     _users = dbContext.LiteDatabase.GetCollection <TUser>("users");
     _cancellationTokens = dbContext.LiteDatabase.GetCollection <CancellationToken>("cancellationtokens");
 }
 public ClothesRepository(ILiteDbContext liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }
Beispiel #10
0
 public CustomerService(ILiteDbContext liteDbContext)
 {
     _liteDb   = liteDbContext.Database;
     _liteColl = _liteDb.GetCollection <Customer>("Customer");
 }
 public UserService(ILiteDbContext liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }
 public RichList(ILiteDbContext liteDb, IMongoDbContext dbContext, IConfiguration config) : base(dbContext, config)
 {
     dbCtx = liteDb;
 }
Beispiel #13
0
 public AluguelRepository(ILiteDbContext context, IEventStream eventStream, IMapper mapper)
 {
     _db          = context;
     _eventStream = eventStream;
     _mapper      = mapper;
 }
Beispiel #14
0
 public LiteDbWeatherForecastService(ILiteDbContext liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }
 public UserListQueryHandler(ILiteDbContext dbContext)
 {
     _db = dbContext.Database;
 }
Beispiel #16
0
 public NewsHandler(ILiteDbContext liteDbContext)
 {
     _liteDatabase   = liteDbContext.Database;
     _newsCollection = _liteDatabase.GetCollection <News>("news");
     _newsCollection.EnsureIndex(x => x.NewsId);
 }
Beispiel #17
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment hostingEnvironment, IAppCache cache, ILiteDbContext liteDbContext, IDatabaseInitializer databaseInitializer)
        {
            Global.ServiceScope       = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope();
            Global.ApplicationBuilder = app;
            Global.AppCache           = cache;

            app.UseStaticFiles();

            if (hostingEnvironment.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAuthentication();

            // Init Plugins
            foreach (JProperty plugin in Global.CoreRuntime["Plugins"])
            {
                if ((bool)Global.CoreRuntime["Plugins"][plugin.Name]["Enabled"] == false)
                {
                    continue;
                }

                if ((string)Global.CoreRuntime["Plugins"][plugin.Name]["WwwRootDataFolder"] != null)
                {
                    app.UseStaticFiles(new StaticFileOptions()
                    {
                        FileProvider = new PhysicalFileProvider(Global.DataPath + "/" + plugin.Name + "/wwwroot"),
                        RequestPath  = new PathString("/" + plugin.Name)
                    });
                }

                if ((string)Global.CoreRuntime["Plugins"][plugin.Name]["WwwRoot"] != null)
                {
                    app.UseStaticFiles(new StaticFileOptions()
                    {
                        FileProvider = new PhysicalFileProvider((string)Global.CoreRuntime["Plugins"][plugin.Name]["WwwRoot"]),
                        RequestPath  = new PathString("/" + plugin.Name)
                    });
                }
            }

            app.UseWebSockets();

            app.UseSignalR(route => route.MapSignalrRoutes());

            app.UseMvc();

            // Init Database
            databaseInitializer.Initialize();

            // DI is ready - Init
            RuntimeSettings.Init();

            Global.WebServerReady = true;
        }
Beispiel #18
0
 public Repository(ILiteDbContext liteDbContext)
 {
     LiteDb         = liteDbContext?.Database ?? throw new ArgumentException("The context can not be null. Please check your DI container configuration and check if the container has declared the instance of the context");
     CollectionName = typeof(T).Name;
 }
Beispiel #19
0
 public StudentService(ILiteDbContext context)
 {
     _context = context;
 }
Beispiel #20
0
 public Supply(ILiteDbContext ctx)
 {
     dbCtx = ctx;
     LoadRichData();
 }
 public LiteDbFlowerService(ILiteDbContext liteDbContext)
 {
     liteDb = liteDbContext.Database;
 }
        private ILiteCollection <Book> books => liteDb.GetCollection <Book>("Books"); // tk export this to options, like database string

        public LiteDbBookService(ILiteDbContext context, IDtoMapper mapper)
        {
            liteDb      = context.Database;
            this.mapper = mapper;
        }
Beispiel #23
0
 public LiteDbRoleStore(ILiteDbContext dbContext)
 {
     _roles = dbContext.LiteDatabase.GetCollection <TRole>("roles");
     _cancellationTokens = dbContext.LiteDatabase.GetCollection <CancellationToken>("cancellationtokens");
 }
Beispiel #24
0
 public UserEditCommandHandler(ILiteDbContext dbContext)
 {
     _db = dbContext.Database;
 }
Beispiel #25
0
 public LiteDBRepository(ILiteDbContext ctx)
 {
     Collection = ctx.LiteDatabase.GetCollection <T>();
 }
 public MoneyTransactionRepository(ILiteDbContext liteDbContext)
 {
     _collection = liteDbContext.MoneyTransactions;
 }
Beispiel #27
0
 public TaxedCitiesServices(ILiteDbContext liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }
Beispiel #28
0
 public LiteDbContractorService(ILiteDbContext liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }
Beispiel #29
0
 public DeckRepository(ILiteDbContext context, IHashids hashids)
 {
     db       = context.Database;
     _hashids = hashids;
 }
Beispiel #30
0
 public LiteDbImageRepository(ILiteDbContext liteDbContext)
 {
     _liteDb = liteDbContext.Database;
 }