You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running a sample application using sqlserver EFCore provider. The application uses an aggregate type ContactDetails which has a DateTime property DOB.
While inserting some data in the table, I see the associated JSON column has following data.
Please notice, the DOB field has value 2023-02-03T00:00:00.
I want to ask from database providers perspective if EFCore databse providers have any control over how the values are populated for JSON column.
For Ex:- A database may not understand the DOB field value format in which it is currently inserted, and they may want to insert the DOB field value in a different format.
Tried using converters (For Ex:- using DateTimeToStringConverter) in the provider for the DateTimeTypeMapping doesn't seem a good idea to resolve this since then the converter will be used for the non-JSON DateTime field as well.
For Ex:- If an application has following entities-
Then, Can it be allowed by the database providers to not use any converter for JoinDate property which is a non-JSON property, but use some kind of converter for the DOB property which is a JSON field property, while providing TypeMapping for the entity properties?
Or Is there any other way to achieve this without using converters?
Currently I am not able to do so.
I am running a sample application using sqlserver EFCore provider. The application uses an aggregate type
ContactDetails
which has aDateTime
propertyDOB
.While inserting some data in the table, I see the associated JSON column has following data.
Please notice, the
DOB
field has value2023-02-03T00:00:00
.I want to ask from database providers perspective if EFCore databse providers have any control over how the values are populated for JSON column.
For Ex:- A database may not understand the
DOB
field value format in which it is currently inserted, and they may want to insert theDOB
field value in a different format.Tried using converters (For Ex:- using
DateTimeToStringConverter
) in the provider for the DateTimeTypeMapping doesn't seem a good idea to resolve this since then the converter will be used for thenon-JSON DateTime
field as well.For Ex:- If an application has following entities-
Then, Can it be allowed by the database providers to not use any converter for
JoinDate
property which is a non-JSON property, but use some kind of converter for theDOB
property which is a JSON field property, while providing TypeMapping for the entity properties?Or Is there any other way to achieve this without using converters?
Currently I am not able to do so.
Here is the sample application I am using.
Include provider and version information
EF Core version: EFCore 7.0.5
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows 10
IDE: Visual Studio 2022 17.4
The text was updated successfully, but these errors were encountered: