Closed mrt181 closed 1 month ago
Hi @mrt181, could you please confirm if the solution below works for you?
using ksqlDb.RestApi.Client.DependencyInjection;
using ksqlDb.RestApi.Client.FluentAPI.Builders;
using ksqlDB.RestApi.Client.KSql.Query.Options;
using ksqlDB.RestApi.Client.KSql.RestApi.Enums;
var builder = WebApplication.CreateBuilder(args);
ModelBuilder modelBuilder = new();
builder.Services.ConfigureKSqlDb(
builder.Configuration.GetConnectionString("KafkaConnection")!,
parameters =>
{
parameters
.SetAutoOffsetReset(AutoOffsetReset.Latest)
.SetIdentifierEscaping(IdentifierEscaping.Always)
.SetJsonSerializerOptions(options =>
{
options.PropertyNameCaseInsensitive = true;
});
}
).AddSingleton(modelBuilder);
Yes, that works.
I have an asp.net minimal API service that wires KSqlDbRestApiClient using the below config in Program.cs
I would like to use
ModelBuilder
to configure my entities but the only documented way I see is to provide the builder when creating a new KSqlDbRestApiClient. Is there a way to build my model using theModelBuilder
and add it to the config for any instance that is created?