Skip to content

Commit

Permalink
upgrade to .net8
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEggenberger committed Mar 24, 2024
1 parent 2d7a242 commit 22114d6
Show file tree
Hide file tree
Showing 129 changed files with 592 additions and 331 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Modules.Channels.Features.Aggregates.ChannelAggregate.Application.Commands;
using Modules.Channels.Features.Aggregates.ChannelAggregate.Application.Queries;
using Shared.Kernel.BuildingBlocks.Authorization.Attributes;
using Shared.Kernel.Constants;
using Shared.Kernel.BuildingBlocks.Auth.Constants;

namespace Modules.Channels.Web.Server.Controllers
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Modules.TenantIdentity.Features.Infrastructure.EFCore;
using Shared.Features.CQRS.Query;
using Shared.SharedKernel.Constants;
using Shared.Kernel.BuildingBlocks.Auth.Constants;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Modules.TenantIdentity.Features.Aggregates.UserAggregate;
using System.Threading.Tasks;
using System.Collections.Generic;
using Shared.SharedKernel.Constants;
using Shared.Kernel.BuildingBlocks.Auth.Constants;

namespace Modules.TenantIdentity.Features.Infrastructure
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using Shared.Modules.Layers.Application.CQRS.Command;
using Module.Shared.Modules.Layers.Features;
using Shared.Modules.Layers.Features.Identity.Commands;
using Shared.SharedKernel.Constants;
using ApplicationUserManager = Shared.Modules.Layers.Features.Identity.ApplicationUserManager;
using Shared.SharedKernel.Exstensions;
using Shared.Kernel.BuildingBlocks.Auth.Constants;

namespace WebServer.Controllers.Identity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
using Microsoft.Extensions.Hosting;
using Modules.TenantIdentity.Layers.Features;
using Shared.Features.Modules;
using Shared.Kernel.BuildingBlocks.Auth.Constants;
using Shared.Kernel.BuildingBlocks.Authorization.Services;
using Shared.SharedKernel.Constants;
using System.Reflection;
using System.Security.Claims;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Shared.Features.DomainKernel.Interfaces;
using Shared.Features.Domain;
using Shared.Kernel.BuildingBlocks;

namespace Shared.Features.CQRS.DomainEvent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Shared.Features.DomainKernel.Interfaces;
using Shared.Features.Domain;

namespace Shared.Features.CQRS.DomainEvent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Shared.Features.DomainKernel.Interfaces;
using Shared.Features.Domain;

namespace Shared.Features.CQRS.DomainEvent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Shared.Features.DomainKernel.Interfaces;
using Shared.Kernel.BuildingBlocks;

namespace Shared.Features.CQRS.IntegrationEvent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Shared.Features.DomainKernel.Interfaces;
using Shared.Kernel.BuildingBlocks;

namespace Shared.Features.CQRS.IntegrationEvent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Shared.Features.DomainKernel.Interfaces;
using Shared.Kernel.BuildingBlocks;

namespace Shared.Features.CQRS.IntegrationEvent
{
Expand Down
23 changes: 23 additions & 0 deletions Source/Shared/Features/Domain/AggregateRoot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using SendGrid.Helpers.Errors.Model;
using Shared.Kernel.BuildingBlocks.Auth.DomainKernel;
using Shared.Kernel.BuildingBlocks;
using Shared.SharedKernel.Interfaces;
using System.ComponentModel.DataAnnotations.Schema;

namespace Shared.Features.Domain
{
public class AggregateRoot : Entity, ITenantIdentifiable
{
[NotMapped]
public IExecutionContext ExecutionContext { get; set; }
public virtual Guid TenantId { get; set; }

public void ThrowIfCallerIsNotInRole(TenantRole role)
{
if (ExecutionContext.TenantRole != role)
{
throw new UnauthorizedException();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Shared.Features.DomainKernel.Exceptions;
using Shared.Features.DomainKernel.Interfaces;
using Shared.SharedKernel.Interfaces;

namespace Shared.Features.DomainKernel
namespace Shared.Features.Domain
{
public abstract class Entity : IAuditable, IIdentifiable, IConcurrent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Shared.Features.DomainKernel
namespace Shared.Features.Domain.Exceptions
{
public class DomainException : Exception
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Shared.Features.DomainKernel.Exceptions
using Shared.Features.Domain.Exceptions;

namespace Shared.Features.DomainKernel.Exceptions
{
public class InvalidEntityDeleteException : DomainException
{
Expand Down
6 changes: 6 additions & 0 deletions Source/Shared/Features/Domain/IDomainEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Shared.Features.Domain
{
public interface IDomainEvent
{
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Shared.Features.DomainKernel
namespace Shared.Features.Domain
{
public abstract class ValueObject
{
Expand Down
9 changes: 0 additions & 9 deletions Source/Shared/Features/DomainKernel/AggregateRoot.cs

This file was deleted.

This file was deleted.

This file was deleted.

24 changes: 24 additions & 0 deletions Source/Shared/Features/EFCore/ExecutionContextInterceptor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Shared.Features.Domain;
using Shared.Kernel.BuildingBlocks;

namespace Shared.Features.EFCore
{
public class ExecutionContextInterceptor : SaveChangesInterceptor
{
public object InitializedInstance(
MaterializationInterceptionData materializationData,
object instance)
{
if (instance is AggregateRoot aggregateRoot)
{
aggregateRoot.ExecutionContext = materializationData
.Context
.GetService<IExecutionContext>();
}

return instance;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Shared.Features.Domain;
using Shared.Features.DomainKernel;
using Shared.Features.DomainKernel.Attributes;
using System.Reflection;
Expand Down
26 changes: 26 additions & 0 deletions Source/Shared/Features/EFCore/Registrator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Shared.Features.EFCore.Configuration;
using Shared.Features.Modules.Configuration;

namespace Shared.Features.EFCore
{
public static class Registrator
{
public static IServiceCollection AddEFCore(this IServiceCollection services, IConfiguration configuration)
{
services.RegisterModuleConfiguration<EFCoreConfiguration, EFCoreConfigurationValidator>(configuration);
services.AddScoped<TransactionScopeMiddleware>();

return services;
}

public static IApplicationBuilder UseEFCoreMiddleware(this IApplicationBuilder app)
{
app.UseMiddleware<TransactionScopeMiddleware>();

return app;
}
}
}
18 changes: 18 additions & 0 deletions Source/Shared/Features/EFCore/TransactionScopeMiddleware.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Http;
using System.Transactions;

namespace Shared.Features.EFCore
{
public class TransactionScopeMiddleware : IMiddleware
{
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
await next(context);

scope.Complete();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Shared.Features.Modules.Configuration
{
public interface IModuleConfiguration
{
}
}
Loading

0 comments on commit 22114d6

Please sign in to comment.