public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddHttpClient(); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddTransient<ILocalStorageService, LocalStorageService>(); services.AddSweetAlert2(options => { options.Theme = SweetAlertTheme.Dark; }); services.AddScoped<IserverNamesService, ServerNameService>(); services.AddScoped<IDatabaseService, DatabaseService>(); services.AddScoped<IapplicationService, ApplicationService>(); services.AddHttpClient(); //services.AddScoped<HttpClient>(); services.AddAutoMapper(typeof(Startup)); //Configration services.Configure<Schema>(Configuration.GetSection("Schema")); services.Configure<DBConnectionAppIds>(Configuration.GetSection("DBConnectionAppIds")); var connection = "Server=EGRNDDEVL15\\AHMEDSALAH;database=UC_AppRepository_PY;uid=sa;Password=ahmed@123;Encrypt=false;"; connection = connection + "TrustServerCertificate=True;"; //DB Context //var connection = new DBCredentials().GetConnectionString(Configuration["DBConnectionAppIds:AppID"]); //connection = connection + "TrustServerCertificate=True;"; services.AddDbContext<AppsRepositoryDBContext>(options => options.UseSqlServer(connection)); services.AddTransient<IConnectionDatabase, ConnectionDatabase>(); //Services services.AddScoped<ILoginService, LoginService>(); services.AddTransient(typeof(IRepository<>), typeof(BaseRepository<>)); services.AddScoped<ICommonService, CommonService>(); services.AddScoped<IEmplyeeService, EmplyeeService>(); services.AddControllers(); services.AddScoped<IRegisterService, RegisterService>(); services.AddScoped<ILocalStorageService, LocalStorageService>(); //Identity Authentication services.AddIdentity<IdentityUser, IdentityRole>(Option => Option.SignIn.RequireConfirmedAccount = false) .AddDefaultUI() .AddDefaultTokenProviders() .AddEntityFrameworkStores<AppsRepositoryDBContext>(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); } } }
services.AddServerSideBlazor();
var builder = WebAssemblyHostBuilder.CreateDefault(args);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)