Using DateTime properties in Code-First Entity Framework and SQL Server

后端 未结 4 1991
半阙折子戏
半阙折子戏 2020-11-29 03:07

I have an example class book:

public class Book
{
    [Key]
    public int Id { get; set; }
    public string Name { get; set; }
    public Date         


        
4条回答
  •  一个人的身影
    2020-11-29 03:38

    If migrations are enabled you can also adjust stuff right there.

    public override void Up()
    {
        CreateTable(
            "dbo.MyTable",
            c => new
            {
                Date = c.DateTime(false, 7, storeType: "datetime2"),
            });
    }
    

提交回复
热议问题