Configuration & Persistence Integrations — SharedKernel
Entity Framework Core (SharedKernel.EntityFrameworkCore)
Section titled “Entity Framework Core (SharedKernel.EntityFrameworkCore)”Register DomainEventsInterceptor (DomainEventDispatchTiming.AfterCommit is the v4.0.0 default) and configure strongly-typed ID value converters without reflection:
using EricksonLopez.SharedKernel.EntityFrameworkCore;using Microsoft.EntityFrameworkCore;using Microsoft.Extensions.DependencyInjection;
namespace Example.SharedKernelConfig;
public static class PersistenceConfiguration{ public static void Register(IServiceCollection services) { services.AddSharedKernelDomainEventsInterceptor(); }
public static void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) { configurationBuilder.ConfigureStrongIdsFromAssembly(typeof(PersistenceConfiguration).Assembly); }}- Dapper (
EricksonLopez.SharedKernel.Dapper): Register strongly-typed IDs viaDapperStrongIdRegistry.Register<TId, TValue>()(orRegisterByConvention) and BCL types (DateOnly,DateTimeOffset,TimeOnly) viaDapperBclTypeHandlerRegistry. - JSON (
EricksonLopez.SharedKernel.Json): UseStrongIdJsonConverter<TSelf, TValue>,StrongIdJsonConverterFactory, andSharedKernelJsonModifiers.IgnoreLegacyDomainEventAliases. - OpenTelemetry (
EricksonLopez.SharedKernel.OpenTelemetry): CalltracerBuilder.AddSharedKernelInstrumentation()andmeterBuilder.AddSharedKernelInstrumentation().