Skip to content

Commit

Permalink
Migrate to .NET Core 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kgrzybek committed Mar 4, 2020
1 parent d63aec7 commit 90ee5e8
Show file tree
Hide file tree
Showing 48 changed files with 423 additions and 162 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>2b9855d3-f073-44d2-aa45-b15e896794b9</UserSecretsId>
</PropertyGroup>
Expand All @@ -20,15 +20,13 @@

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.4.0" />
<PackageReference Include="FluentValidation" Version="8.4.0" />
<PackageReference Include="Hellang.Middleware.ProblemDetails" Version="3.1.0" />
<PackageReference Include="IdentityServer4" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
<PackageReference Include="FluentValidation" Version="8.6.2" />
<PackageReference Include="Hellang.Middleware.ProblemDetails" Version="4.2.0" />
<PackageReference Include="IdentityServer4" Version="3.1.2" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
22 changes: 13 additions & 9 deletions src/API/CompanyName.MyMeetings.API/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using CompanyName.MyMeetings.BuildingBlocks.Application;
using CompanyName.MyMeetings.BuildingBlocks.Domain;
using CompanyName.MyMeetings.BuildingBlocks.Infrastructure.Emails;
using CompanyName.MyMeetings.Modules.Meetings.Application.Configuration;
using CompanyName.MyMeetings.Modules.UserAccess.Application.IdentityServer;
using Hellang.Middleware.ProblemDetails;
using IdentityServer4.AccessTokenValidation;
Expand All @@ -18,7 +17,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
Expand All @@ -28,6 +26,7 @@
using CompanyName.MyMeetings.Modules.Meetings.Infrastructure.Configuration;
using CompanyName.MyMeetings.Modules.Payments.Infrastructure.Configuration;
using CompanyName.MyMeetings.Modules.UserAccess.Infrastructure.Configuration;
using Microsoft.Extensions.Hosting;

namespace CompanyName.MyMeetings.API
{
Expand All @@ -38,7 +37,7 @@ public class Startup
private static ILogger _logger;
private static ILogger _loggerForApi;

public Startup(IHostingEnvironment env)
public Startup(IWebHostEnvironment env)
{
ConfigureLogger();

Expand All @@ -51,16 +50,15 @@ public Startup(IHostingEnvironment env)

public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddControllers();

services.AddSwaggerDocumentation();

ConfigureIdentityServer(services);

services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<IExecutionContextAccessor, ExecutionContextAccessor>();

services
.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

services.AddProblemDetails(x =>
{
x.Map<InvalidCommandException>(ex => new InvalidCommandProblemDetails(ex));
Expand All @@ -82,12 +80,14 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider)
{
app.UseMiddleware<CorrelationMiddleware>();

app.UseSwaggerDocumentation();



app.UseIdentityServer();

if (env.IsDevelopment())
Expand All @@ -103,8 +103,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, IService

app.UseHttpsRedirection();

app.UseMvc();

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints => { endpoints.MapControllers(); });

}

private static void ConfigureLogger()
Expand Down
37 changes: 25 additions & 12 deletions src/API/CompanyName.MyMeetings.API/SwaggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Reflection;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Swashbuckle.AspNetCore.Swagger;
using Microsoft.OpenApi.Models;

namespace CompanyName.MyMeetings.API
{
Expand All @@ -14,8 +14,7 @@ internal static IServiceCollection AddSwaggerDocumentation(this IServiceCollecti
{
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new Info
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "MyMeetings API",
Version = "v1",
Expand All @@ -27,19 +26,33 @@ internal static IServiceCollection AddSwaggerDocumentation(this IServiceCollecti
var commentsFile = Path.Combine(baseDirectory, commentsFileName);
options.IncludeXmlComments(commentsFile);

var securityToken = new Dictionary<string, IEnumerable<string>>
{
{"Bearer", new string[] { }},
};

options.AddSecurityDefinition("Bearer", new ApiKeyScheme
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
In = "header",
Type = "apiKey"
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey
});
options.AddSecurityRequirement(securityToken);

options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
},
Scheme = "oauth2",
Name = "Bearer",
In = ParameterLocation.Header,

},
new List<string>()
}
});

});
return services;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="7.0.0" />
<PackageReference Include="MediatR" Version="6.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Autofac" Version="4.9.2" />
<PackageReference Include="MediatR" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="MediatR" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
</ItemGroup>

<ItemGroup>
Expand Down
102 changes: 100 additions & 2 deletions src/Database/ClearDatabase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ GO
DROP TABLE [meetings].[MeetingGroups]
GO

DROP TABLE [meetings].[MeetingGroupPayments]
DROP TABLE [payments].[MeetingGroupPayments]
GO

DROP TABLE [meetings].[Meetings]
Expand All @@ -73,8 +73,106 @@ GO
DROP VIEW [meetings].[v_MeetingGroups]
GO


DROP TABLE [administration].[Members]
GO

DROP VIEW [administration].[v_MeetingGroupProposals]
GO

DROP VIEW [administration].[v_Members]
GO

DROP SCHEMA [administration]
GO

DROP TABLE [meetings].[MeetingNotAttendees]
GO

DROP TABLE [meetings].[MeetingWaitlistMembers]
GO

DROP TABLE [meetings].[Members]
GO

DROP VIEW [meetings].[v_Meetings]
GO

DROP VIEW [meetings].[v_Members]
GO

DROP SCHEMA [meetings]
GO
GO

DROP TABLE payments.InboxMessages

DROP TABLE payments.InternalCommands
GO

DROP TABLE payments.MeetingGroupPaymentRegisters
GO


DROP TABLE payments.MeetingPayments
GO

DROP TABLE payments.OutboxMessages
GO

DROP TABLE payments.Payers
GO

DROP VIEW payments.v_MeetingGroupPaymentRegisters
GO

DROP VIEW payments.v_MeetingGroupPayments
GO

DROP VIEW payments.v_MeetingPayments
GO

DROP VIEW payments.v_Payers
GO

DROP SCHEMA [payments]
GO

DROP TABLE users.InboxMessages
GO

DROP TABLE users.InternalCommands
GO


DROP TABLE users.OutboxMessages
GO

DROP TABLE users.[RolesToPermissions]
GO

DROP TABLE users.[Permissions]
GO

DROP TABLE users.[Users]
GO

DROP TABLE users.[UserRoles]
GO

DROP TABLE users.[UserRegistrations]
GO

DROP VIEW users.[v_UserPermissions]
GO

DROP VIEW users.[v_UserRegistrations]
GO

DROP VIEW users.[v_UserRoles]
GO

DROP VIEW users.[v_Users]
GO

DROP SCHEMA [users]
GO
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Autofac.Extras.CommonServiceLocator" Version="5.0.0" />
<PackageReference Include="CommonServiceLocator" Version="2.0.4" />
<PackageReference Include="Dapper" Version="1.60.6" />
<PackageReference Include="FluentValidation" Version="8.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="FluentValidation" Version="8.6.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Quartz" Version="3.0.7" />
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 90ee5e8

Please sign in to comment.