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
The DB default in MySql is correct, but when saving this entity, without setting the Created property, it defaults to the DateTime Min of '0001-01-01 00:00:00'. If you do an insert directly in MySql it obviously works fine.
I would assume the correct behavior would be to read back the value or use in the sql statment 'UTC_TIMESTAMP()'.
I can workaround by setting date in code, but would be good to understand if this is just bug or not.
Further technical details
DotNet Core 1.0 RTM
MySQL version: 5.7
Pomelo.EntityFrameworkCore.MySql version: 1.0.0-prerelease-20160803
The text was updated successfully, but these errors were encountered:
Hi @greghroberts. DateTime is a value type in .net. The default value is going to be default(DateTime) if you did not specify a default value, is '0001-01-01 00:00:00'.
You can also define a default value in your model:
I understand it's a value type. My question is more on if you plan on making DefaultValues work as per the EF docs. The attached example and link do not work as designed.
Steps To Reproduce
From the docs sample: https://ef.readthedocs.io/en/latest/modeling/relational/default-values.html
The issue
The DB default in MySql is correct, but when saving this entity, without setting the Created property, it defaults to the DateTime Min of '0001-01-01 00:00:00'. If you do an insert directly in MySql it obviously works fine.
I would assume the correct behavior would be to read back the value or use in the sql statment 'UTC_TIMESTAMP()'.
I can workaround by setting date in code, but would be good to understand if this is just bug or not.
Further technical details
DotNet Core 1.0 RTM
MySQL version: 5.7
Pomelo.EntityFrameworkCore.MySql version: 1.0.0-prerelease-20160803
The text was updated successfully, but these errors were encountered: