Skip to content

Commit 236af58

Browse files
committed
fix readme
1 parent f8c8901 commit 236af58

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ var car = new Car {
140140
First we need to specify property converters. `PropertyConverters` is a dictionary. The key is the
141141
property name and the value is a `PropertyConverter`, which specifies how to convert to and from `EntityProperty`.
142142

143+
```c#
144+
var propertyConverters = new PropertyConverters<Car> {
145+
[nameof(car.ReleaseDate)] =
146+
new PropertyConverter<Car>(x =>
147+
new EntityProperty(car.ReleaseDate.ToString("yyyy-M-d")),
148+
(c,p) =>c.ReleaseDate = DateTime.Parse(p.StringValue)
149+
)
150+
};
151+
```
143152
Finally, pass the `PropertyConverters` object when converting to and from your table entities.
144153

145154
Note that in production use cases you don't have to always instantiate your property converters, you should have a single instance and re-use.

0 commit comments

Comments
 (0)