Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kubinko authored and satano committed Nov 26, 2019
1 parent 3eaeb19 commit 925531a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ To contribute with new topics/information or make changes, see [contributing](ht
* [ASP.NET Core Extensions](#aspnet-core-extensions)
* [Database Migrations](#database-migrations)
* [Id Generators](#id-generators)
* [Converters](#converters)

### ASP.NET Core Extensions

Expand Down Expand Up @@ -155,3 +156,18 @@ public void ConfigureServices(IServiceCollection services)
.InitDatabaseForIdGenerator();
}
```

### Converters

KORM supports custom converters (via [IConverter](https://kros-sk.github.io/Kros.Libs.Documentation/api/Kros.KORM/Kros.KORM.Converter.IConverter.html) implementation) for converting values from DB to objects and vice versa. These converters are set for individual columns in `OnModelCreating` method of database configuration class (`DatabaseConfigurationBase`).

If you need to convert text formatted as JSON from database to entity, you can use pre-defined converter - `JsonConverter`:

``` csharp
public override void OnModelCreating(ModelConfigurationBuilder modelBuilder)
{
modelBuilder.Entity<MyEntity>()
.HasTableName(MyEntityTableName)
.Property(x => x.MySerializableProperty).UseConverter<JsonConverter>();
}
```

0 comments on commit 925531a

Please sign in to comment.