mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-02-16 10:58:32 -05:00
Initial commit from private
This commit is contained in:
31
Weather/Service/Startup.cs
Normal file
31
Weather/Service/Startup.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Weather.Service.Data;
|
||||
|
||||
namespace Weather.Service
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddTransient<Database>();
|
||||
|
||||
services.AddHostedService<MessageHandler>();
|
||||
|
||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder applicationBuilder, IHostingEnvironment environment)
|
||||
{
|
||||
if (environment.IsDevelopment())
|
||||
applicationBuilder.UseDeveloperExceptionPage();
|
||||
|
||||
var database = applicationBuilder.ApplicationServices.GetService<Database>();
|
||||
database.EnsureDatabase();
|
||||
|
||||
applicationBuilder.UseMvc();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user