// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, DBContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Cars}/{action=Index}/{id?}"); }); //Runs DB initialisation, checking if it exists, else creating it and adding content DBInit.Init(context); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { Current = this; DBInit.Init(); LabelHtml.Forms.Plugin.iOS.HtmlLabelRenderer.Initialize(); global::Xamarin.Forms.Forms.Init(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); var ignore = typeof(FFImageLoading.Svg.Forms.SvgCachedImage); AiForms.Effects.iOS.Effects.Init(); ZXing.Net.Mobile.Forms.iOS.Platform.Init(); FormsControls.Touch.Renderers.Init(); //Plugin.GoogleClient.GoogleClientManager.Initialize(); LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
public static void Main(string[] args) { var host = CreateWebHostBuilder(args).Build(); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService <PlatziSquareDbContext>(); DBInit.Init(context); } catch (Exception ex) { var logger = services.GetRequiredService <ILogger <Program> >(); logger.LogError(ex, "Error llenando la base de datos."); } } host.Run(); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Instance = this; AndroidEnvironment.UnhandledExceptionRaiser += MyApp_UnhandledExceptionHandler; DBInit.Init(); LabelHtml.Forms.Plugin.Droid.HtmlLabelRenderer.Initialize(); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); global::Xamarin.Forms.FormsMaterial.Init(this, savedInstanceState); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true); FFImageLoading.Forms.Platform.CachedImageRenderer.InitImageViewHandler(); var ignore = typeof(FFImageLoading.Svg.Forms.SvgCachedImage); AiForms.Effects.Droid.Effects.Init(); ZXing.Net.Mobile.Forms.Android.Platform.Init(); LoadApplication(new App()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); DBInit.Init(app); } app.UseHttpsRedirection(); app.UseRouting(); app.UseSession(); app.UseStaticFiles(); //Bruke HTML-filen app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
//Initialization databse and paste start products, users public UsersController(WebStoreContext context) { this.db = context; DBInit.Init(context); }
//Initialization databse and paste start products, users public ProductsController(WebStoreContext context) { this.db = context; DBInit.Init(context); }