PostProcessor Class postproc post-processor NetCorePal Template Expansion
name Name of the processor class MyProcessor dto Name of the DTO prefix My { public Task PostProcessAsync($dto$Request req, $dto$Response res, HttpContext ctx, IReadOnlyCollection fails, CancellationToken c) { $end$ } }]]>
Test Class tstclass test class NetCorePal Template Expansion
name Name of the test class My fixture Name of the fixture App test_name Name of the test method Name_Of_The_Test { public $name$Tests($fixture$Fixture f, ITestOutputHelper o) : base(f, o) { } [Fact] public async Task $test_name$() { $end$ } }]]>
Endpoint with Request Only epreq endpoint with request only NetCorePal Template Expansion
epName Name of the endpoint My verb HTTP verb Post route Route pattern route-pattern { public override void Configure() { $verb$("$route$"); AllowAnonymous(); } public override async Task HandleAsync($epName$Request r, CancellationToken c) { $end$ } }]]>
NetCorePal Command ncpcmd create command NetCorePal Template Expansion
name Name of the command My { public $name$CommandValidator() { // Add validation rules example: // RuleFor(x => x.Property).NotEmpty(); } } public class $name$CommandHandler : ICommandHandler<$name$Command> { public async Task Handle( $name$Command request, CancellationToken cancellationToken) { // Implement business logic throw new NotImplementedException(); } }]]>
NetCorePal Command with Response ncpcmdres create command with response NetCorePal Template Expansion
name Name of the command My ; public record $name$CommandResponse(); public class $name$CommandValidator : AbstractValidator<$name$Command> { public $name$CommandValidator() { // Add validation rules example: // RuleFor(x => x.Property).NotEmpty(); } } public class $name$CommandHandler : ICommandHandler<$name$Command, $name$CommandResponse> { public async Task<$name$CommandResponse> Handle( $name$Command request, CancellationToken cancellationToken) { // Implement business logic throw new NotImplementedException(); } }]]>
Endpoint Request and Response DTOs epdto endpoint request and response dtos NetCorePal Template Expansion
name Name prefix My
NetCorePal Aggregate Root ncpar create aggregate root NetCorePal Template Expansion
name Name of the aggregate My , IAggregateRoot { protected $name$() { } }]]>
Test Fixture tstfixture test fixture NetCorePal Template Expansion
name Name of the fixture App { public $name$Fixture(IMessageSink s) : base(s) { } protected override Task SetupAsync() { $end$ } protected override void ConfigureServices(IServiceCollection s) { } protected override Task TearDownAsync() { } }]]>
Event Handler evnt event handler NetCorePal Template Expansion
name Name of the event MyEvent { public Task HandleAsync($name$ e, CancellationToken c) { $end$ } }]]>
NetCorePal Repository ncprepo create repository NetCorePal Template Expansion
name Name of the entity My ; public class $name$Repository(ApplicationDbContext context) : RepositoryBase<$name$, $name$Id, ApplicationDbContext>(context), I$name$Repository { }]]>
FastEndpoint NCP Style epp endpoint vertical slice - NCP NetCorePal Template Expansion
epName Name of the endpoint My verb HTTP verb Post route Route pattern route-pattern summaryText Summary text Summary text goes here... descriptionText Description text Description text goes here... > { public override void Configure() { $verb$("$route$"); AllowAnonymous(); } public override async Task HandleAsync($epName$Request r, CancellationToken c) { var cmd = new $epName$Command(r.Property1, r.Property2); var result = await mediator.Send(cmd, c); var res = new $epName$Response(); await SendOkAsync(res.AsResponseData(), c); $end$ } } sealed record $epName$Request(); sealed record $epName$Response(); sealed class $epName$Validator : Validator<$epName$Request> { public $epName$Validator() { // RuleFor(x => x.Property).NotEmpty(); } } sealed class $epName$Summary : Summary<$epName$Endpoint, $epName$Request> { public $epName$Summary() { Summary = "$summaryText$"; Description = "$descriptionText$"; } }]]>
NetCorePal Integration Event ncpie integration event NetCorePal Template Expansion
name Name of the integration event My { public async Task HandleAsync($name$IntegrationEvent integrationEvent, CancellationToken cancellationToken) { // Implement integration event handling logic throw new NotImplementedException(); $end$ } }]]>
NetCorePal Domain Event Handler ncpdeh domain event handler NetCorePal Template Expansion
name Name of the domain event My { public async Task HandleAsync($name$DomainEvent domainEvent, CancellationToken cancellationToken) { // Implement domain event handling logic throw new NotImplementedException(); $end$ } }]]>
NetCorePal Integration Event Converter ncpiec integration event converter NetCorePal Template Expansion
domainEventName Name of the domain event My integrationEventName Name of the integration event My { public $integrationEventName$IntegrationEvent Convert($domainEventName$DomainEvent domainEvent) { return new $integrationEventName$IntegrationEvent( // Map domain event properties to integration event ); $end$ } }]]>
NetCorePal Domain Event ncpde domain event NetCorePal Template Expansion
name Name of the domain event My
Endpoint with Response Only epres endpoint with response only NetCorePal Template Expansion
epName Name of the endpoint My verb HTTP verb Get route Route pattern route-pattern { public override void Configure() { $verb$("$route$"); AllowAnonymous(); } public override async Task HandleAsync(CancellationToken c) { $end$ } }]]>
Endpoint Validator epval endpoint validator NetCorePal Template Expansion
epName Name of the endpoint My { public $epName$Validator() { $end$ } }]]>
Endpoint Mapper epmap endpoint mapper NetCorePal Template Expansion
epName Name of the endpoint My entity Entity name YourEntity { public override $entity$ ToEntity($epName$Request r) => new() { $end$ }; public override $epName$Response FromEntity($entity$ e) => new() { }; }]]>
FastEndpoint Full Vertical Slice epfull endpoint vertical slice NetCorePal Template Expansion
epName Name of the endpoint My verb HTTP verb Post route Route pattern route-pattern entity Entity name YourEntity summaryText Summary text Summary text goes here... descriptionText Description text Description text goes here... { public override void Configure() { $verb$("$route$"); AllowAnonymous(); } public override async Task HandleAsync($epName$Request r, CancellationToken c) { $end$ } } sealed class $epName$Request { } sealed class $epName$Response { } sealed class $epName$Validator : Validator<$epName$Request> { public $epName$Validator() { } } sealed class $epName$Mapper: Mapper<$epName$Request, $epName$Response, $entity$> { public override $entity$ ToEntity($epName$Request r) => new() { }; public override $epName$Response FromEntity($entity$ e) => new() { }; } sealed class $epName$Summary : Summary<$epName$Endpoint, $epName$Request> { public $epName$Summary() { Summary = "$summaryText$"; Description = "$descriptionText$"; } }]]>
Endpoint Summary epsum endpoint summary NetCorePal Template Expansion
epName Name of the endpoint My summaryText Summary text Summary text goes here... descriptionText Description text Description text goes here... { public $epName$Summary() { Summary = "$summaryText$"; Description = "$descriptionText$"; $end$ } }]]>
Endpoint Without Request epnoreq endpoint without request NetCorePal Template Expansion
epName Name of the endpoint My verb HTTP verb Get route Route pattern route
Endpoint with Request and Response epreqres endpoint with request and response NetCorePal Template Expansion
epName Name of the endpoint My verb HTTP verb Post route Route pattern route-pattern { public override void Configure() { $verb$("$route$"); AllowAnonymous(); } public override async Task HandleAsync($epName$Request r, CancellationToken c) { $end$ } }]]>
Endpoint Data epdat endpoint data NetCorePal Template Expansion
epName Name of the data class My
Command Handler with Result cmdres command handler with result NetCorePal Template Expansion
name Name of the command MyCommand { } sealed class $name$Result { } sealed class $name$Handler : ICommandHandler<$name$, $name$Result> { public Task<$name$Result> ExecuteAsync($name$ cmd, CancellationToken c) { $end$ } }]]>
Command Handler cmd command handler NetCorePal Template Expansion
name Name of the command MyCommand { public Task ExecuteAsync($name$ cmd, CancellationToken c) { $end$ } }]]>
Global Pre-processor preproc_g global pre-processor NetCorePal Template Expansion
name Name of the processor MyProcessor fails, CancellationToken c) { $end$ } }]]>
Pre-processor preproc pre-processor NetCorePal Template Expansion
name Name of the processor MyProcessor dto Name of the DTO My { public Task PreProcessAsync($dto$Request r, HttpContext ctx, List fails, CancellationToken c) { $end$ } }]]>
Global Post-processor postproc_g global post-processor NetCorePal Template Expansion
name Name of the processor MyProcessor fails, CancellationToken c) { $end$ } }]]>
Test Method tstmethod test method NetCorePal Template Expansion
testName Name of the test method Name_Of_The_Test
NetCorePal Entity Configuration ncpconfig 创建实体配置类 NetCorePal Template Expansion
Entity Entity name Entity table Table name table { public void Configure(EntityTypeBuilder<$Entity$> builder) { builder.ToTable("$table$"); builder.HasKey(t => t.Id); builder.Property(t => t.Id) /*.UseSnowFlakeValueGenerator()*/ // 如果使用 SnowFlake ID 生成器,请取消注释 /*.UseGuidVersion7ValueGenerator()*/ // 如果使用 Guid Version 7 ID 生成器,请取消注释 ; // Configure other properties if needed $end$ } }]]>