Skip to content

Instantly share code, notes, and snippets.

apiVersion: kube-green.com/v1alpha1
kind: SleepInfo
metadata:
name: working-hours
spec:
weekdays: "1-5"
sleepAt: "20:00"
wakeUpAt: "08:00"
timeZone: "Europe/Rome"
{
"$schema": "https://github.com/Azure/data-api-builder/releases/latest/download/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"options": {
"set-session-context": false
},
"connection-string": "@env('DATABASE_CONNECTION_STRING')"
},
"runtime": {
app_location: "/src"
api_location: "api"
output_location: "/dist"
data_api_location: "db-config" # Folder holding the staticwebapp.database.config.json file
<PropertyGroup>
<NoWarn>$(NoWarn);AD0001</NoWarn>
</PropertyGroup>
services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService("Example-Services"))
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddSqlClientInstrumentation(options=> options.SetDbStatementForText=true)
.AddHotChocolateInstrumentation()
.AddAzureMonitorTraceExporter(options => {
options.ConnectionString = Configuration.GetSection("ApplicationInsights").GetValue<string>("ConnectionString");
}));
services.AddOpenTelemetryTracing(builder =>
{
builder.AddHttpClientInstrumentation();
builder.AddAspNetCoreInstrumentation();
builder.AddSqlClientInstrumentation(options => {
options.SetDbStatementForText = true;
});
builder.AddHotChocolateInstrumentation();
builder.SetResourceBuilder(api);
builder.AddAzureMonitorTraceExporter(options =>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.2.0" />
<PackageReference Include="GraphQL.Server.Ui.Playground" Version="5.2.0" />
<PackageReference Include="GraphQL.Server.Ui.Voyager" Version="5.2.0" />
export interface CommandProcessor {
handle<CommandType extends Command>(
commandHandler: CommandHandler<CommandType>,
...commandTypes: CommandTypeOf<CommandType>[]
): void;
}
type CommandTypeOf<T extends Command> = T['type'];
public static void Handle(ICommand command) => command switch {
CreateUserCommand createCommand=> CreateUser(createCommand.Name,createCommand.Email); break,
DeleteUserCommand deleteCommand => DeleteUser(deleteCommand.UserId),
_ => throw new InvalidOperationException("Unknown command type")
};