コード例 #1
0
ファイル: Startup.cs プロジェクト: gabod2000/grubNow
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, GrubNowDbContext ctx,
                              UserManager <AppUser> userManager, RoleManager <AppRole> roleManager)
        {
            //Add Cors and Ogiins From request To acces Date
            List <string> origins = new List <string> {
                "http://localhost:4200", "https://localhost:4200"
            };

            app.UseCors(options => options
                        .WithOrigins(origins.ToArray())
                        .AllowAnyMethod().AllowCredentials().AllowAnyHeader().SetIsOriginAllowed((host) => true));

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

            app.UseHttpsRedirection();

            //Use Swagger
            //app.UseSwagger();
            ////Use Swagger UI
            //app.UseSwaggerUI(c =>
            //{
            //    c.SwaggerEndpoint("/swagger/v1/swagger.json", "PLENUM Project V1");
            //});

            app.UseRouting();

            // Add Athentication And Authorizationm
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseHttpsRedirection();
            app.UseResponseCompression();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            //Used for logging using ILogger and SeriLog
            //var t = Configuration["Environment"];
            //if (Configuration["Environment"] == "Local" || Configuration["Environment"] == "Dev")
            //{
            //    app.UseMiddleware(typeof(ErrorHandlingMiddleware));
            //}

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();

                //Use SignalR In Core 3.0.0
                endpoints.MapHub <SignalRHub>(Configuration.GetSection("SignalRPath").Value);
            });
            // DbInitializer.Initialize(ctx, userManager, roleManager);

            app.UseOpenApi();
            app.UseSwaggerUi3();
            app.UseReDoc(); // serve ReDoc UI
        }
コード例 #2
0
 public CategoryBL(IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _BusinessBase = new BusinessBase <Category>(serviceProvider);
     _context      = serviceProvider.GetRequiredService <GrubNowDbContext>();
 }
コード例 #3
0
ファイル: BlogBL.cs プロジェクト: gabod2000/grubNow
 public BlogBL(IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _BusinessBase = new BusinessBase <Blogs>(serviceProvider);
     response      = new BaseResponse();
     _context      = serviceProvider.GetRequiredService <GrubNowDbContext>();
 }
コード例 #4
0
 public ListOfAllDataReposity(GrubNowDbContext context)
 {
     _context = context;
 }
コード例 #5
0
ファイル: BusinessBase.cs プロジェクト: gabod2000/grubNow
 public BusinessBase(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
     plenumDbContext  = serviceProvider.GetRequiredService <GrubNowDbContext>();
     repositoryBase   = new RepositoryBase <T>(serviceProvider);
 }
コード例 #6
0
 public RepositoryBase(IServiceProvider serviceProvider)
 {
     _context = serviceProvider.GetService <GrubNowDbContext>();
 }
コード例 #7
0
ファイル: EFRepository.cs プロジェクト: gabod2000/grubNow
 public EfRepository(GrubNowDbContext context)
 {
     _context = context;
 }