public SeedController(ISeedService seedService, IWarehouseService warehouseService, IHttpContextAccessor httpContextAccessor) { _seedService = seedService; _warehouseService = warehouseService; _httpContextAccessor = httpContextAccessor; userId = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISeedService seedService) { seedService.SeedUsers(); seedService.SeedRedirects(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "redirect", pattern: "r/{id?}", defaults: new { controller = "Home", action = "Redirect" } ); endpoints.MapRazorPages(); }); }
public StorageEfCoreService(ILogger logger, ISeedService seedService, AppDbContext context) { _logger = logger; _seedService = seedService; _context = context; }
public StorageSpService(IStorageStore storageStore, ILogger logger, ISeedService seedService, AppDbContext context) { _storageStore = storageStore; _logger = logger; _seedService = seedService; _context = context; }
public ProductController(ISeedService seedService, IFertilizerService fertilizerService, IYieldService yieldService, IPesticideService pesticideService, IHttpContextAccessor httpContextAccessor) { _seedService = seedService; _fertilizerService = fertilizerService; _yieldService = yieldService; _pesticideService = pesticideService; _httpContextAccessor = httpContextAccessor; }
public LoginModel(SignInManager <IdentityUser> signInManager, ILogger <LoginModel> logger, UserManager <IdentityUser> userManager, ISeedService seedService) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _seedService = seedService; }
public ImportCiqualExcelService( IAlimentCategoryRepository alimentCategoryRepository, IAlimentRepository alimentRepository, INutritionalValueRepository nutritionalValueRepository, ISeedService seedService) { _alimentCategoryRepository = alimentCategoryRepository; _alimentRepository = alimentRepository; _nutritionalValueRepository = nutritionalValueRepository; _seedService = seedService; }
public virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { _adService = null; _seedService = null; } this.disposed = true; } }
public SowingController(ISowingService sowingService, ISeedService seedService, IWarehouseService warehouseService, IFieldService fieldService, IHttpContextAccessor httpContextAccessor, IMapper mapper, ITypeSowingService typeSowingService) { _sowingService = sowingService; _typeSowingService = typeSowingService; _seedService = seedService; _warehouseService = warehouseService; _fieldService = fieldService; _mapper = mapper; _httpContextAccessor = httpContextAccessor; userId = userId = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; }
public TestsController(IQMaster question, ISurvey survey, IAMaster answerOptions, IResult results, ISeedService seedService, IQuestion demoQuestions, ISurveyMaster demoSurveyMasters, ISessionUser demoSessionUsers, IAnswerOption demoAnswerOptions) { _questions = question; _answers = survey; _answerOptions = answerOptions; _results = results; _seedService = seedService; _demoQuestions = demoQuestions; _demoAnswerOptions = demoAnswerOptions; _demoSessionUsers = demoSessionUsers; _demoSurveys = demoSurveyMasters; }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ISeedService seedService) { if (env.IsDevelopment()) { } try { seedService.Seed().Wait(); } catch (Exception ex) { throw ex; } }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISeedService seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { #region global Exception handler app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddAppError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); #endregion //app.UseHsts(); } //کامنت کردم بخاطر اینکه هردفعه برنامه اجرا بشه لیستی از یوزر اضافه میکنه برامون //seeder.SeedUsers(); //چون تست هستش اجازه میدم به همه اورجین های من دسترسی داشته باشه app.UseCors(p => p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); //app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseOpenApi(); app.UseSwaggerUi3(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
/// <summary> /// Main /// </summary> public static void Main(/*string[] args*/) { ICaller caller = new Caller("Seeder"); DependencyInjection(); ISeedService seedService = InstanceFactory.GetInstance <ISeedService>(); seedService.Suits(caller); seedService.Ranks(caller); seedService.Cards(caller); seedService.PackColours(caller); seedService.SetColours(caller); seedService.ErrorReasonGroups(caller); seedService.ErrorReasons(caller); seedService.SetPurposes(caller); seedService.Owners(caller); seedService.Sets(caller); seedService.Dealers(caller); seedService.Organisers(caller); seedService.Seasons(caller); }
public CompetitionEntityConfiguration(ISeedService seedService) => _seedService = seedService;
public UserEntityConfiguration(ISeedService seedService) => _seedService = seedService;
public SeedController(ISeedService seedService) { _seedService = seedService ?? throw new ArgumentNullException(nameof(seedService)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISeedService seeder) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(builder => { builder.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; var error = context.Features.Get <IExceptionHandlerFeature>(); if (error != null) { context.Response.AddAppError(error.Error.Message); await context.Response.WriteAsync(error.Error.Message); } }); }); } app.UseHttpsRedirection(); //seeder.SeedUsers(); app.UseCors(c => c.WithOrigins("http://*****:*****@"File")), RequestPath = new PathString("/File") }); #region swagger with configue // serve documents (same as app.UseSwagger()) //app.UseOpenApi( //// option => ////{ option.DocumentName = "swagger"; //// option.Path = "/swagger/v1/swagger.json"; ////} //) //; //app.UseSwaggerUi3( //// option => ////{ //// option.Path = "/Helper"; //// option.DocumentPath = "/swagger/v1/swagger.json"; ////} //); // serve Swagger UI //app.UseReDoc(option => //{ // option.Path = "/redoc"; // option.DocumentPath = "/swagger/v1/swagger.json"; //}); #endregion /swagger with configue app.UseMvc(); //app.UseEndpoints(endpoints => // { // endpoints.MapControllers(); // }); }
public EditModel(ISeedService seedService, Beryl.Data.BerylSqliteContext context) { _seedService = seedService; _context = context; }
public static async Task Seed(ApplicationDbContext context, RoleManager <IdentityRole <int> > roleManager, UserManager <User> userManager, IHostingEnvironment env, IAccountService userService, ISeedService seedService) { //to make sure that the database is created, if not, it will be created context.Database.EnsureCreated(); string adminRole = nameof(Role.ADMINISTRATOR); string userRole = nameof(Role.USER); if (await roleManager.FindByNameAsync(adminRole) == null) { var ir = await roleManager.CreateAsync(new IdentityRole <int>(adminRole)); } if (await roleManager.FindByNameAsync(userRole) == null) { var ir = await roleManager.CreateAsync(new IdentityRole <int>(userRole)); } var admin = await userManager.GetUsersInRoleAsync(adminRole); var adminUser = string.Empty; var dataPath = Path.Combine(env.ContentRootPath, "Data", "seed"); if (Directory.Exists(dataPath)) { var adminSettings = Path.Combine(dataPath, "adminsettings.json"); if (File.Exists(adminSettings)) { AddAccountDTO sa = JsonConvert.DeserializeObject <AddAccountDTO>(System.IO.File.ReadAllText(adminSettings)); if (admin.Count() == 0) { var addAdmin = new User { UserName = sa.userName, Email = sa.email, firstName = sa.firstName, lastName = sa.lastName, EmailConfirmed = true }; var result = await userManager.CreateAsync(addAdmin, sa.password); if (result.Succeeded) { var addrole = await userManager.AddToRoleAsync(addAdmin, adminRole); //File.Delete(adminSettings); } adminUser = sa.userName; } else { adminUser = admin.FirstOrDefault().UserName; } } } // var module = Path.Combine(dataPath, "module.json"); if (File.Exists(module)) { List <AddModuleDTO> dto = JsonConvert.DeserializeObject <List <AddModuleDTO> >(System.IO.File.ReadAllText(module)); var result = await seedService.AddModule(dto, adminUser); if (result.success) { //File.Delete(modules); } } }
public SeedController(ISeedService seedService) { _seedService = seedService; }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMigrationManager migrationManager, ISeedService seedService) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/JobOffer/Error"); } app.UseStaticFiles(); app.UseStatusCodePagesWithReExecute("/JobOffer/Error", "?statusCode={0}"); app.UseRequestLocalization(); app.UseAuthentication(); migrationManager.Apply().Wait(); seedService.Seed().Wait(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=JobOffer}/{action=Popular}/{id?}"); }); }
public SeedsController(ISeedService seedService, UserManager <ApplicationUser> userManager) { _seedService = seedService; _userManager = userManager; }
public CommentEntitiyConfiguration(ISeedService seedService) => _seedService = seedService;
public MemoryConfigurator(ISeedService seedService) { this.seedService = seedService; }
public MotherboardConfigurator(ISeedService seedService) { this.seedService = seedService; }
public HomeController(ILogger <HomeController> logger, ISeedService seedService) { _logger = logger; this.seedService = seedService; }
public HomeController(ILogger <HomeController> logger, BerylInMemoryContext inMemoryContext, ISeedService seedService) { _logger = logger; _inMemoryContext = inMemoryContext; _seedService = seedService; }
public PSUConfigurator(ISeedService seedService) { this.seedService = seedService; }
public CaseConfiguration(ISeedService seedService) { this.seedService = seedService; }
public BookingSystemDbContext(DbContextOptions <BookingSystemDbContext> options, ISeedService seedService) : base(options) => _seedService = seedService;