Skip to content

Commit

Permalink
Updated to .Net Core 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Sep 27, 2018
1 parent 3701d99 commit 889f229
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
13 changes: 4 additions & 9 deletions GenericSearch.UI/GenericSearch.UI.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
Expand All @@ -19,5 +15,4 @@
<ProjectReference Include="..\GenericSearch.Grammar\GenericSearch.Grammar.csproj" />
<ProjectReference Include="..\GenericSearch.Paging\GenericSearch.Paging.csproj" />
</ItemGroup>

</Project>
</Project>
16 changes: 4 additions & 12 deletions GenericSearch.UI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace GenericSearch.UI
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
CreateWebHostBuilder(args).Build().Run();
}

public static IWebHost BuildWebHost(string[] args) =>
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
.UseStartup<Startup>();
}
}
2 changes: 1 addition & 1 deletion GenericSearch.UI/SortLinkTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace GenericSearch.UI
{
[HtmlTargetElement("a")]
[HtmlTargetElement("a", Attributes = "paging,property-name")]
public class SortLinkTagHelper : TagHelper
{
private readonly IHttpContextAccessor httpContextAccessor;
Expand Down
12 changes: 9 additions & 3 deletions GenericSearch.UI/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

Expand All @@ -17,33 +19,37 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();

services.AddMvc(options =>
{
// add custom binder to beginning of collection
options.ModelBinderProviders.Insert(0, new AbstractSearchModelBinderProvider());
});
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=DefaultSearch}/{action=Index}/{id?}");
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
Expand Down

0 comments on commit 889f229

Please sign in to comment.