Removed AspNet 2.2 dependencies from test application

This commit is contained in:
David Barker
2021-03-03 16:54:23 +08:00
parent 91329b8653
commit 4c8bd6a225
3 changed files with 30 additions and 30 deletions
@@ -8,20 +8,15 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNetCore.Identity.MongoDbCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.17.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.13.0-beta1" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.12" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.12" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.12" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.12" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.1" /> <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.12" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.12" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.0" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -35,5 +30,10 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<!-- Select one of the following to build this solution -->
<ItemGroup>
<!-- <PackageReference Include="AspNetCore.Identity.MongoDbCore" Version="3.1.0" /> -->
<ProjectReference Include="..\..\src\AspNetCore.Identity.MongoDbCore.csproj" />
</ItemGroup>
</Project> </Project>
+12 -14
View File
@@ -1,15 +1,15 @@
using AspNetCore.Identity.MongoDbCore.Infrastructure; using System;
using AspNetCore.Identity.MongoDbCore.Infrastructure;
using AspNetCore.Identity.MongoDbCore.Models; using AspNetCore.Identity.MongoDbCore.Models;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using MongoIdentitySample.Mvc.Models; using MongoIdentitySample.Mvc.Models;
using MongoIdentitySample.Mvc.Services; using MongoIdentitySample.Mvc.Services;
using Microsoft.Extensions.Logging;
using System;
namespace MongoIdentitySample.Mvc namespace MongoIdentitySample.Mvc
{ {
@@ -24,7 +24,7 @@ namespace MongoIdentitySample.Mvc
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
//per user config that is not committed to repo, use this to override settings (e.g. connection string) based on your local environment. //per user config that is not committed to repo, use this to override settings (e.g. connection string) based on your local environment.
.AddJsonFile($"appsettings.local.json", optional: true); .AddJsonFile($"appsettings.local.json", optional: true);
builder.AddEnvironmentVariables(); builder.AddEnvironmentVariables();
Configuration = builder.Build(); Configuration = builder.Build();
@@ -48,16 +48,15 @@ namespace MongoIdentitySample.Mvc
var builder = services.AddRazorPages(); var builder = services.AddRazorPages();
#if DEBUG #if DEBUG
if(_env.IsDevelopment()) if (_env.IsDevelopment())
{ {
builder.AddRazorRuntimeCompilation(); builder.AddRazorRuntimeCompilation();
} }
#endif #endif
services.AddMvc(); services.AddMvc();
services.AddApplicationInsightsTelemetry(); services.AddApplicationInsightsTelemetry();
// Add application services. // Add application services.
@@ -71,7 +70,6 @@ namespace MongoIdentitySample.Mvc
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
app.UseBrowserLink();
} }
else else
{ {
@@ -67,11 +67,13 @@ namespace Microsoft.AspNetCore.Identity.Test
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
if (concurrentSetup) if (concurrentSetup)
{ {
services.ConfigureMongoDbIdentity<TUser, TRole, TKey>(Container.MongoDbIdentityConfiguration, Container.MongoRepositoryConcurrent.Context).AddDefaultTokenProviders(); services.ConfigureMongoDbIdentity<TUser, TRole, TKey>(Container.MongoDbIdentityConfiguration, Container.MongoRepositoryConcurrent.Context)
.AddDefaultTokenProviders();
} }
else else
{ {
services.ConfigureMongoDbIdentity<TUser, TRole, TKey>(Container.MongoDbIdentityConfiguration, Container.MongoRepository.Context).AddDefaultTokenProviders(); services.ConfigureMongoDbIdentity<TUser, TRole, TKey>(Container.MongoDbIdentityConfiguration, Container.MongoRepository.Context)
.AddDefaultTokenProviders();
} }
services.AddLogging(); services.AddLogging();