Now buildable targetting .net 3.1
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Web;
|
using NLog.Web;
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ namespace Icarus
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.Debug("init main");
|
logger.Debug("init main");
|
||||||
CreateWebHostBuilder(args).Build().Run();
|
|
||||||
|
CreateHostBuilder(args).Build().Run();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -34,14 +36,12 @@ namespace Icarus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
WebHost.CreateDefaultBuilder(args).UseStartup<Startup>()
|
// TODO: Need to add Logging support and maybe adding CLI port support
|
||||||
.UseUrls("http://localhost:5002")
|
Host.CreateDefaultBuilder(args)
|
||||||
.ConfigureLogging(logging =>
|
.ConfigureWebHostDefaults(webBuilder =>
|
||||||
{
|
{
|
||||||
logging.ClearProviders();
|
webBuilder.UseStartup<Startup>();
|
||||||
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
});
|
||||||
})
|
|
||||||
.UseNLog();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-19
@@ -41,8 +41,7 @@ namespace Icarus
|
|||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
services.AddControllers();
|
||||||
services.AddSingleton<IConfiguration>(Configuration);
|
|
||||||
|
|
||||||
string domain = $"https://{Configuration["Auth0:Domain"]}/";
|
string domain = $"https://{Configuration["Auth0:Domain"]}/";
|
||||||
|
|
||||||
@@ -109,25 +108,25 @@ namespace Icarus
|
|||||||
var connString = Configuration.GetConnectionString("DefaultConnection");
|
var connString = Configuration.GetConnectionString("DefaultConnection");
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(SongRepository),
|
services.Add(new ServiceDescriptor(typeof(SongRepository),
|
||||||
new SongRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new SongRepository(connString)));
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(AlbumRepository),
|
services.Add(new ServiceDescriptor(typeof(AlbumRepository),
|
||||||
new AlbumRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new AlbumRepository(connString)));
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(ArtistRepository),
|
services.Add(new ServiceDescriptor(typeof(ArtistRepository),
|
||||||
new ArtistRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new ArtistRepository(connString)));
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(GenreRepository),
|
services.Add(new ServiceDescriptor(typeof(GenreRepository),
|
||||||
new GenreRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new GenreRepository(connString)));
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(YearRepository),
|
services.Add(new ServiceDescriptor(typeof(YearRepository),
|
||||||
new YearRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new YearRepository(connString)));
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(CoverArtRepository),
|
services.Add(new ServiceDescriptor(typeof(CoverArtRepository),
|
||||||
new CoverArtRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new CoverArtRepository(connString)));
|
||||||
|
|
||||||
services.Add(new ServiceDescriptor(typeof(UserRepository),
|
services.Add(new ServiceDescriptor(typeof(UserRepository),
|
||||||
new UserRepository(Configuration.GetConnectionString("DefaultConnection"))));
|
new UserRepository(connString)));
|
||||||
|
|
||||||
services.AddDbContext<SongContext>(options => options.UseMySQL(connString));
|
services.AddDbContext<SongContext>(options => options.UseMySQL(connString));
|
||||||
services.AddDbContext<AlbumContext>(options => options.UseMySQL(connString));
|
services.AddDbContext<AlbumContext>(options => options.UseMySQL(connString));
|
||||||
@@ -141,17 +140,14 @@ namespace Icarus
|
|||||||
// Called by the runtime. Use this method to configure the HTTP request pipeline.
|
// Called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||||
{
|
{
|
||||||
if (env.IsDevelopment())
|
// NOTE: Dev-related configuration can be done when env.IsDevelopment() evaluated to true
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
else
|
|
||||||
// The default HSTS value is 30 days.
|
|
||||||
// You may want to change this for production scenarios
|
|
||||||
app.UseHsts();
|
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseRouting();
|
||||||
|
app.UseAuthorization();
|
||||||
app.UseHttpsRedirection();
|
app.UseEndpoints(endpoints =>
|
||||||
app.UseMvc();
|
{
|
||||||
|
endpoints.MapControllers();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user