Skip to content

Commit

Permalink
Migrated to dot net core 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron committed May 13, 2020
1 parent b4edc30 commit 5bc64a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
7 changes: 1 addition & 6 deletions DVSA.TEST.WEB.API/DVSA.TEST.WEB.API.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>c17f21e9-be75-4a5c-b680-6e438e12e6ab</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DVSA.MOT.SDK\DVSA.MOT.SDK.csproj" />
</ItemGroup>
Expand Down
20 changes: 13 additions & 7 deletions DVSA.TEST.WEB.API/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using DVSA.MOT.SDK;
using DVSA.MOT.SDK.Interfaces;
using DVSA.MOT.SDK.Models;
using DVSA.MOT.SDK.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace DVSA.TEST.WEB.API
{
public class Startup
{
public IHostingEnvironment HostingEnvironment { get; private set; }
public IWebHostEnvironment HostingEnvironment { get; private set; }
public IConfiguration Configuration { get; private set; }

public Startup(IConfiguration configuration, IHostingEnvironment env)
public Startup(IConfiguration configuration, IWebHostEnvironment env)
{
HostingEnvironment = env;
Configuration = configuration;
Expand All @@ -24,15 +23,15 @@ public Startup(IConfiguration configuration, IHostingEnvironment env)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest);
services.Configure<ApiKey>(Configuration.GetSection("MotApi"));
services.AddDvlaMotSdk();
services.AddOptions();
services.AddLogging();
}

// This method gets 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, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
Expand All @@ -44,7 +43,14 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
}

app.UseHttpsRedirection();
app.UseMvc();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
});
}
}
}

0 comments on commit 5bc64a4

Please sign in to comment.