Pomelo.EntityFrameworkCore.MySql icon indicating copy to clipboard operation
Pomelo.EntityFrameworkCore.MySql copied to clipboard

WithClrDateTime() should allow to specify the exact precision

Open lauxjpn opened this issue 5 years ago • 0 comments

Currently WithClrDateTime is defined like the following:

public enum MySqlDateTimeType
{
    Default,
    DateTime,
    DateTime6,
    Timestamp6,
    Timestamp,
}

public MySqlDefaultDataTypeMappings WithClrDateTime(
    MySqlDateTimeType mysqlDateTimeType)
{
}

Something like the following might be the way to go:

public enum MySqlDateTimeType
{
    Default,
    DateTime,
    Timestamp,
}

public MySqlDefaultDataTypeMappings WithClrDateTime(
    MySqlDateTimeType mysqlDateTimeType,
    int precision = -1)
{
    // If mysqlDateTimeType == Default, use datetime with highest supported precision.
    // Otherwise if precision < 0, use specified type with highest supported precision.
    // Otherwise use whatever has been specified.
}

Same applies to the other date/time related options.

lauxjpn avatar May 27 '20 13:05 lauxjpn