Entity Framework 4.1 The model backing the context has changed since the database was created, immediately after creating DB

后端 未结 7 2166
孤城傲影
孤城傲影 2020-12-05 23:47

I am working on a project which uses Entity Framework 4.1 for persisting our various objects to the database (code first).

I am testing in Visual Studio with a local

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 00:15

    Are the two servers running your application running different operating systems (or service packs?) It appears the SHA256CryptoService used can throw a PlatformNotSupportedException which causes it to fallback to another method.

    http://msdn.microsoft.com/en-us/library/system.security.cryptography.sha256cryptoserviceprovider.sha256cryptoserviceprovider.aspx

    // System.Data.Entity.Internal.CodeFirstCachedMetadataWorkspace
    private static SHA256 GetSha256HashAlgorithm()
    {
      SHA256 result;
      try
      {
        result = new SHA256CryptoServiceProvider();
      }
      catch (PlatformNotSupportedException)
      {
        result = new SHA256Managed();
      }
      return result;
    }
    

    You may be able to test this by using reflection to invoke the following 2 (internal/private) methods on each server.

    MetaDataWorkspace.ToMetadataWorkspace(DbDatabaseMapping, Action)
    CodeFirstCachedMetadataWorkspace.ComputeSha256Hash(string xml);
    

提交回复
热议问题