Adds Generic CommandHandlerDecorator
This commit is contained in:
parent
49f9b99ee1
commit
64e696dc5a
21 changed files with 131 additions and 110 deletions
7
Core/CommandQueries/Command.cs
Normal file
7
Core/CommandQueries/Command.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace PlanTempus.Core.CommandQueries;
|
||||
|
||||
public abstract class Command : ICommand
|
||||
{
|
||||
public required Guid CorrelationId { get; set; }
|
||||
public Guid TransactionId { get; set; }
|
||||
}
|
||||
16
Core/CommandQueries/CommandResponse.cs
Normal file
16
Core/CommandQueries/CommandResponse.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
namespace PlanTempus.Core.CommandQueries;
|
||||
|
||||
public class CommandResponse
|
||||
{
|
||||
public Guid RequestId { get; }
|
||||
public Guid CorrelationId { get; }
|
||||
public Guid? TransactionId { get; }
|
||||
public DateTime CreatedAt { get; }
|
||||
|
||||
public CommandResponse(Guid correlationId)
|
||||
{
|
||||
CorrelationId = correlationId;
|
||||
RequestId = Guid.CreateVersion7();
|
||||
CreatedAt = DateTime.Now;
|
||||
}
|
||||
}
|
||||
7
Core/CommandQueries/ICommand.cs
Normal file
7
Core/CommandQueries/ICommand.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace PlanTempus.Core.CommandQueries;
|
||||
|
||||
public interface ICommand
|
||||
{
|
||||
Guid CorrelationId { get; set; }
|
||||
Guid TransactionId { get; set; }
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ public class DatabaseScope : IDisposable
|
|||
Connection = connection;
|
||||
_operation = operation;
|
||||
_operation.Telemetry.Success = true;
|
||||
_operation.Telemetry.Timestamp = DateTimeOffset.UtcNow;
|
||||
_stopwatch = Stopwatch.StartNew();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace PlanTempus.Core.ModuleRegistry
|
|||
var client = new Microsoft.ApplicationInsights.TelemetryClient(configuration);
|
||||
client.Context.GlobalProperties["Application"] = GetType().Namespace?.Split('.')[0];
|
||||
client.Context.GlobalProperties["MachineName"] = Environment.MachineName;
|
||||
client.Context.GlobalProperties["Version"] = Environment.Version.ToString();
|
||||
client.Context.GlobalProperties["CLRVersion"] = Environment.Version.ToString();
|
||||
client.Context.GlobalProperties["ProcessorCount"] = Environment.ProcessorCount.ToString();
|
||||
|
||||
builder.Register(c => client).InstancePerLifetimeScope();
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Akka" Version="1.5.32" />
|
||||
<PackageReference Include="Autofac" Version="8.1.1" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.11.0" />
|
||||
<PackageReference Include="Insight.Database" Version="8.0.1" />
|
||||
<PackageReference Include="Insight.Database.Providers.PostgreSQL" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.22.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.3.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.1" />
|
||||
<PackageReference Include="npgsql" Version="9.0.2" />
|
||||
<PackageReference Include="Seq.Api" Version="2024.3.0" />
|
||||
<PackageReference Include="Sodium.Core" Version="1.3.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac" Version="8.1.1"/>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0"/>
|
||||
<PackageReference Include="FluentValidation" Version="11.11.0"/>
|
||||
<PackageReference Include="Insight.Database" Version="8.0.1"/>
|
||||
<PackageReference Include="Insight.Database.Providers.PostgreSQL" Version="8.0.1"/>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0"/>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.22.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.3.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.1"/>
|
||||
<PackageReference Include="npgsql" Version="9.0.2"/>
|
||||
<PackageReference Include="Seq.Api" Version="2024.3.0"/>
|
||||
<PackageReference Include="Sodium.Core" Version="1.3.5"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Configurations\AzureAppConfigurationProvider\" />
|
||||
<Folder Include="Configurations\PostgresqlConfigurationBuilder\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Configurations\AzureAppConfigurationProvider\"/>
|
||||
<Folder Include="Configurations\PostgresqlConfigurationBuilder\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue