|
ValidateWebApp
|
Functions | |
| builder.Services. | AddControllersWithViews () .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix) |
| builder.Services. | AddDbContextFactory< ServiceContext > (options=> options.UseSqlServer(connectionString)) |
| builder.Services. | AddSingleton< LocService > () |
| builder.Services. | AddLocalization (options=> { options.ResourcesPath="Resources";}) |
| builder.Services. | Configure< RequestLocalizationOptions > (options=> { var supportedCultures=new[] { new CultureInfo("sk-SK"), new CultureInfo("en-GB") };options.DefaultRequestCulture=new RequestCulture("en-GB");options.SupportedUICultures=supportedCultures;}) |
| app. | UseRequestLocalization () |
| if (!app.Environment.IsDevelopment()) | |
| app. | UseWebSockets (webSocketsOptions) |
| app. | UseStaticFiles () |
| app. | UseRouting () |
| app. | UseAuthorization () |
| app. | MapControllerRoute (name:"default", pattern:"{controller=Validate}/{action=Index}/{id?}") |
| app. | MapControllerRoute (name:"result", pattern:"{controller=Result}/{id?}") |
| app. | MapControllerRoute (name:"home", pattern:"{controller=Home}/{id?}") |
| app. | MapControllerRoute (name:"webSocket", pattern:"{controller=WebSocket}/{id?}") |
| app. | Run () |
Variables | |
| var | builder = WebApplication.CreateBuilder(args) |
| var | dbHost = Environment.GetEnvironmentVariable("DB_HOST") |
| var | dbName = Environment.GetEnvironmentVariable("DB_NAME") |
| var | dbPassword = Environment.GetEnvironmentVariable("DB_SA_PASSWORD") |
| var | connectionString = $"Data Source={dbHost};Initial Catalog={dbName};User ID=sa;Password={dbPassword};Encrypt = True; Trust Server Certificate=true;" |
| var | app = builder.Build() |
| var | webSocketsOptions |
| builder.Services. AddControllersWithViews | ( | ) |
| builder.Services. AddDbContextFactory< ServiceContext > | ( | options | , |
| options. | UseSqlServerconnectionString ) |
| builder.Services. AddLocalization | ( | options | , |
| { options.ResourcesPath="Resources";} | ) |
| builder.Services. AddSingleton< LocService > | ( | ) |
| builder.Services. Configure< RequestLocalizationOptions > | ( | options | , |
| { var supportedCultures=new[] { new CultureInfo("sk-SK"), new CultureInfo("en-GB") };options.DefaultRequestCulture=new RequestCulture("en-GB");options.SupportedUICultures=supportedCultures;} | ) |
| if | ( | ! | app::Environment::IsDevelopment() | ) |
| app. MapControllerRoute | ( | name:"default" | , |
| pattern:"{controller=Validate}/{action=Index}/{id?}" | ) |
| app. MapControllerRoute | ( | name:"home" | , |
| pattern:"{controller=Home}/{id?}" | ) |
| app. MapControllerRoute | ( | name:"result" | , |
| pattern:"{controller=Result}/{id?}" | ) |
| app. MapControllerRoute | ( | name:"webSocket" | , |
| pattern:"{controller=WebSocket}/{id?}" | ) |
| app. Run | ( | ) |
| app. UseAuthorization | ( | ) |
| app. UseRequestLocalization | ( | ) |
| app. UseRouting | ( | ) |
| app. UseStaticFiles | ( | ) |
| app. UseWebSockets | ( | webSocketsOptions | ) |
| var app = builder.Build() |
| var builder = WebApplication.CreateBuilder(args) |
| var connectionString = $"Data Source={dbHost};Initial Catalog={dbName};User ID=sa;Password={dbPassword};Encrypt = True; Trust Server Certificate=true;" |
| var dbHost = Environment.GetEnvironmentVariable("DB_HOST") |
| var dbName = Environment.GetEnvironmentVariable("DB_NAME") |
| var dbPassword = Environment.GetEnvironmentVariable("DB_SA_PASSWORD") |
| var webSocketsOptions |