Page 1 of 1

CodeFirstOptions.UseDateTimeAsDate is not working in EF Core 2.0.1

Posted: Mon 05 Feb 2018 08:40
by Zerda
Hi, it's me again. I am aware only a part of Entity Framework provider configuration settings is supported for Entity Framework Core.

But it would be nice to have a list which is supported which not.

When creating table with code first, UseDateTimeAsDate seems not working, the column type still be timestamp(7) not date.

Here is a small sample.

Code: Select all

class Program
{
    static void Main(string[] args)
    {
        var config = OracleEntityProviderConfig.Instance;
        config.CodeFirstOptions.UseDateTimeAsDate = true;

        var context = new MyDbContext();
        context.Database.EnsureCreated();
    }
}

class MyDbContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseOracle(@"REDACTED");
    }

    public DbSet<Product> Products { get; set; }
}

class Product
{
    [Key]
    public int Id { get; set; }

    public DateTime Created { get; set; }
}

Re: CodeFirstOptions.UseDateTimeAsDate is not working in EF Core 2.0.1

Posted: Thu 08 Feb 2018 11:08
by Shalex
Zerda wrote:I am aware only a part of Entity Framework provider configuration settings is supported for Entity Framework Core.

But it would be nice to have a list which is supported which not.
Thank you for your suggestion. There is no such a list at the moment.
Zerda wrote:When creating table with code first, UseDateTimeAsDate seems not working, the column type still be timestamp(7) not date.
We will notify you when UseDateTimeAsDate is supported in EF Core.

Re: CodeFirstOptions.UseDateTimeAsDate is not working in EF Core 2.0.1

Posted: Thu 15 Feb 2018 18:02
by Shalex
The config.CodeFirstOptions.UseDateTimeAsDate option is supported in EF Core: viewtopic.php?f=1&t=36602.

Re: CodeFirstOptions.UseDateTimeAsDate is not working in EF Core 2.0.1

Posted: Mon 14 May 2018 08:59
by Zerda
Yes, It's working with DateTime type, but not Nullable<DateTime>.

Would you please take look at this, thank you again.

Re: CodeFirstOptions.UseDateTimeAsDate is not working in EF Core 2.0.1

Posted: Thu 17 May 2018 12:36
by Shalex
Thank you for your report. We will notify you when the issue is fixed.

Re: CodeFirstOptions.UseDateTimeAsDate is not working in EF Core 2.0.1

Posted: Fri 25 May 2018 16:29
by Shalex
The bug with the DateTime? properties, when config.CodeFirstOptions.UseDateTimeAsDate is set to True, in EF Core is fixed: viewtopic.php?f=1&t=37215.