View AddCustomHeader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal sealed class AddCustomHeader : IOperationProcessor | |
{ | |
public bool Process(OperationProcessorContext context) | |
{ | |
var hdrParameter = new OpenApiParameter() | |
{ | |
Name = "x-custom", | |
Kind = OpenApiParameterKind.Header, | |
IsRequired = true, | |
Type = JsonObjectType.String, |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bld = WebApplication.CreateBuilder(); | |
bld.Services | |
.AddFastEndpoints() | |
.SwaggerDocument(o => | |
{ | |
o.DocumentSettings = s => | |
{ | |
s.DocumentName = "Initial Release"; | |
s.Version = "v0"; | |
}; |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FastEndpoints.Swagger; | |
using Microsoft.AspNetCore.JsonPatch; | |
using Microsoft.AspNetCore.JsonPatch.Operations; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Serialization; | |
using NJsonSchema.Annotations; | |
using System.Text.Json; | |
var bld = WebApplication.CreateBuilder(); | |
bld.Services |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FastEndpoints; | |
using MessagePack; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | |
public class JobRecord : IJobStorageRecord | |
{ | |
public Guid Id { get; set; } | |
public string QueueID { get; set; } | |
public object Command { get; set; } |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseRequest | |
{ | |
public string? Id { get; init; } | |
} | |
public class BaseRequestValidator : Validator<BaseRequest> | |
{ | |
public BaseRequestValidator() | |
{ | |
RuleFor(x => x.Id) |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var builder = WebApplication.CreateBuilder(); | |
builder.Services.AddFastEndpoints(); | |
var app = builder.Build(); | |
app.UseRouting(); //should be before auth/cors/fastendpoints middlewares. | |
app.UseAuthorization(); | |
app.UseFastEndpoints(); | |
app.UseEndpoints(_ => { }); //should be right after UseFastEndpoints(). this is the terminating middleware for endpoint routes. | |
if (app.Environment.IsDevelopment()) |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FastEndpoints; | |
using FastEndpoints.Swagger; | |
var bld = WebApplication.CreateBuilder(args); | |
bld.Services.AddFastEndpoints(); | |
bld.Services.AddRazorPages(); | |
bld.Services.AddServerSideBlazor(); | |
bld.Services.SwaggerDocument(); | |
var app = bld.Build(); |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bld = WebApplication.CreateBuilder(); | |
bld.Services | |
.AddSingleton(typeof(IRequestBinder<>), typeof(CustomBinder<>)) | |
.AddFastEndpoints() | |
.SwaggerDocument(); | |
var app = bld.Build(); | |
app.UseAuthorization() | |
.UseFastEndpoints() | |
.UseSwaggerGen(); |
View program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Ardalis.Result; | |
using FastEndpoints; | |
using FastEndpoints.Swagger; | |
var bld = WebApplication.CreateBuilder(); | |
bld.Services | |
.AddFastEndpoints() | |
.SwaggerDocument(); | |
var app = bld.Build(); |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FastEndpoints; | |
using FastEndpoints.Swagger; | |
var bld = WebApplication.CreateBuilder(); | |
bld.Services | |
.AddFastEndpoints() | |
.SwaggerDocument(); | |
var app = bld.Build(); | |
app.UseAuthorization() |
NewerOlder