Skip to content

Instantly share code, notes, and snippets.

@flew2bits
flew2bits / FanOutSample.cs
Created April 12, 2024 11:27
FanOut sample for Dates
using Marten;
using Marten.Events.Projections;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = Host.CreateApplicationBuilder();
builder.Services.AddMarten(opt => {
opt.Connection(builder.Configuration.GetConnectionString("Marten") ?? "Host=localhost; Port=5433; User Id=postgres; Password=pgsql");
opt.Projections.Add<WorkByDayProjection>(ProjectionLifecycle.Inline);
public record MyCommand([property: Identity] Guid Id, string SomeValue);
[AttributeUsage(AttributeTargets.Method)]
public class MyAttribute: Attribute {
public MyAttribute(string something) => Something = something;
public string Something {get;}
}
public static class MyCommandHandler {