File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ var car = new Car {
140
140
First we need to specify property converters. ` PropertyConverters ` is a dictionary. The key is the
141
141
property name and the value is a ` PropertyConverter ` , which specifies how to convert to and from ` EntityProperty ` .
142
142
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
+ ```
143
152
Finally, pass the ` PropertyConverters ` object when converting to and from your table entities.
144
153
145
154
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.
You can’t perform that action at this time.
0 commit comments