Skip to content

Commit 41f9793

Browse files
committed
[ksqlDB.RestApi.Client]: Added Fluent API HasColumnName function to README.md
1 parent 26e29b2 commit 41f9793

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,14 @@ modelBuilder.Entity<Payment>()
369369

370370
modelBuilder.Entity<Payment>()
371371
.Property(b => b.Description)
372-
.Ignore();
372+
.HasColumnName("Desc");
373373

374374
modelBuilder.Entity<Account>()
375375
.HasKey(c => c.Id);
376+
377+
modelBuilder.Entity<Account>()
378+
.Property(b => b.Secret)
379+
.Ignore();
376380
```
377381

378382
C# entity definitions:
@@ -389,6 +393,7 @@ record Account
389393
{
390394
public string Id { get; set; } = null!;
391395
public decimal Balance { get; set; }
396+
public string Secret { get; set; }
392397
}
393398
```
394399

@@ -408,15 +413,16 @@ responseMessage = await restApiProvider.CreateTableAsync<Account>(entityCreation
408413
Generated KSQL:
409414

410415
```SQL
411-
CREATE TYPE Payment AS STRUCT<Id VARCHAR, Amount DECIMAL(10,2)>;
416+
CREATE TYPE Payment AS STRUCT<Id VARCHAR, Amount DECIMAL(10,2), Desc VARCHAR>;
412417

413418
CREATE TABLE IF NOT EXISTS Accounts (
414419
Id VARCHAR PRIMARY KEY,
415420
Balance DECIMAL(14,14)
416421
) WITH ( KAFKA_TOPIC='Account', VALUE_FORMAT='Json', PARTITIONS='3', REPLICAS='3' );
417422
```
418423

419-
The `Description` field in the `Payment` type is ignored during code generation, and the `Id` field in the `Account` table is marked as the **primary key**.
424+
The Description property within the `Payment` type has been customized to override the resulting column name as "Desc".
425+
Additionally, the `Id` property within the `Account` table has been designated as the **primary key**, while the `Secret` property is disregarded during code generation.
420426

421427
### Aggregation functions
422428
List of supported ksqldb [aggregation functions](https://github.com/tomasfabian/ksqlDB.RestApi.Client-DotNet/blob/main/docs/aggregations.md):

0 commit comments

Comments
 (0)