public UserService(ScalpayDbContext context, IMapper mapper, IMemoryCache cache, IHttpContextAccessor accessor) { _context = context; _mapper = mapper; _cache = cache; _accessor = accessor; }
public void InitApplication(ScalpayDbContext context, IWebHostEnvironment env) { // json.net default settings JsonConvert.DefaultSettings = (() => { var settings = new JsonSerializerSettings(); settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; settings.NullValueHandling = NullValueHandling.Ignore; settings.Converters.Add(new StringEnumConverter()); settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); settings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; return(settings); }); // init database context.Database.Migrate(); // add default user if (!context.Users.Any()) { context.Users.Add(new User() { Username = "******", Email = "*****@*****.**", FullName = "Admin", Password = "******", Role = Role.Admin }); context.SaveChanges(); } // add scalpay project if (!context.Projects.Any()) { context.Projects.Add(new Project() { ProjectKey = "__scalpay", Description = "The Scalpay's configurations." }); context.SaveChanges(); } }
public ProjectService(ScalpayDbContext context, IMapper mapper, IMemoryCache cache) { _context = context; _mapper = mapper; _cache = cache; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory, ScalpayDbContext dbContext, ILogger logger) { InitApplication(dbContext, env); loggerFactory.AddSerilog(logger); app.UseScalpayException(); app.UseRouting(); app.UseScalpayAuthentication(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public ProjectPermissionService(ScalpayDbContext context, IMemoryCache cache, IMapper mapper) { _context = context; _cache = cache; _mapper = mapper; }
public ItemService(ScalpayDbContext context, IMemoryCache cache, IMapper mapper) { _context = context; _cache = cache; _mapper = mapper; }