zoukankan      html  css  js  c++  java
  • Code First ef SQL Server 版本不支持数据类型“datetime2”

    When calling DbContext.SaveChanges, I get a DbUpdateException:
    An unhandled exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll. Additional information: An error occurred while updating the entries. See the inner exception for details.

    解决:
    modelBuilder.Entity<Blog>().Property(t => t.CreatedOn).HasColumnName("CreatedOn").HasColumnType("date");

    参考:
    https://social.msdn.microsoft.com/Forums/en-US/16f364d6-2acd-4106-9060-de666f499d57/how-to-set-the-providermanifesttoken-with-ef-code-first?forum=adodotnetentityframework
  • 相关阅读:
    B
    A
    P1057 传球游戏
    P1702 突击考试
    P1394 山上的国度
    P2117 小Z的矩阵
    P1510 精卫填海
    P1294 高手去散步
    P1071 潜伏者
    保留
  • 原文地址:https://www.cnblogs.com/rock_chen/p/8708629.html
Copyright © 2011-2022 走看看