added icon and readmy for nugets, added gitea pipeline, added AoT compatible for all projects that are not AspNetCore specific

This commit is contained in:
2024-12-22 11:59:19 -05:00
parent c6a28f352f
commit b7b88bc258
16 changed files with 147 additions and 56 deletions
@@ -1,11 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<PackageIconUrl>https://avatars.githubusercontent.com/u/52874619?v=4</PackageIconUrl>
<Authors>David Lebee, Mathias Beaulieu-Duncan</Authors>
<TargetFramework>net8.0</TargetFramework>
<IsAotCompatible>true</IsAotCompatible>
<LangVersion>default</LangVersion>
<Company>Open Harbor</Company>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://git.openharbor.io/Open-Harbor/dotnet-cqrs</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<None Include="..\icon.png" Pack="true" PackagePath="" CopyToOutputDirectory="Always" />
<None Include="..\README.md" Pack="true" PackagePath="" CopyToOutputDirectory="Always" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="10.4.0" />
</ItemGroup>
@@ -1,4 +1,5 @@
using FluentValidation;
using System.Diagnostics.CodeAnalysis;
using FluentValidation;
using Microsoft.Extensions.DependencyInjection;
using OpenHarbor.CQRS.Abstractions;
@@ -6,14 +7,14 @@ namespace OpenHarbor.CQRS.FluentValidation;
public static class ServiceCollectionExtensions
{
private static IServiceCollection AddFluentValidator<T, TValidator>(this IServiceCollection services)
private static IServiceCollection AddFluentValidator<T, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TValidator>(this IServiceCollection services)
where TValidator : class, IValidator<T>
{
services.AddTransient<IValidator<T>, TValidator>();
return services;
}
public static IServiceCollection AddCommand<TCommand, TCommandHandler, TValidator>(this IServiceCollection services)
public static IServiceCollection AddCommand<TCommand, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TCommandHandler, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TValidator>(this IServiceCollection services)
where TCommand : class
where TCommandHandler : class, ICommandHandler<TCommand>
where TValidator : class, IValidator<TCommand>
@@ -22,7 +23,7 @@ public static class ServiceCollectionExtensions
.AddFluentValidator<TCommand, TValidator>();
}
public static IServiceCollection AddCommand<TCommand, TCommandResult, TCommandHandler, TValidator>(this IServiceCollection services)
public static IServiceCollection AddCommand<TCommand, TCommandResult, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TCommandHandler, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TValidator>(this IServiceCollection services)
where TCommand : class
where TCommandHandler : class, ICommandHandler<TCommand, TCommandResult>
where TValidator : class, IValidator<TCommand>
@@ -31,13 +32,14 @@ public static class ServiceCollectionExtensions
.AddFluentValidator<TCommand, TValidator>();
}
public static IServiceCollection AddQuery<TQuery, TQueryResult, TQueryHandler, TValidator>(this IServiceCollection services)
public static IServiceCollection AddQuery<TQuery, TQueryResult, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TQueryHandler, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TValidator>(this IServiceCollection services)
where TQuery : class
where TQueryHandler : class, IQueryHandler<TQuery, TQueryResult>
where TValidator : class, IValidator<TQuery>
{
services.AddQuery<TQuery, TQueryResult, TQueryHandler>()
.AddFluentValidator<TQuery, TValidator>();
return services;
}
}