问题描述
我正在使用相关实体框架4代码优先数据模型的AppFabric的更新版本(截至2010年10月20日)。作为其中的一部分,我们将从SQL绘制项目到POCO对象并将这些对象存储在AppFabric中。 我们可以毫无问题地存储/检索项目
。
当我重新编译代码并尝试检索一个项目(我知道它仍然在缓存中)时,我得到了以下异常:
"反序列化程序无法加载要反序列化的类型,因为在程序集'EntityFrameworkDynamicProxies-ACME.Contracts中找不到类型'System.Data.Entity.DynamicProxies.ACMEVersionHisto_0274F07D5CB3ECB757E0533C2AD895AD967B6E8D00FAB202E813E9C48E9493A5',
Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'。检查被序列化的类型与被反序列化的类型具有相同的合同并使用相同的程序集。"
我相信EF4使用的动态代理类支持POCO模型使用不同的签名重新编译,这些签名与那些仍然存储在缓存中的项目不向后兼容 - 即使类的结构保持不变
(即相同的属性/字段/等)。 我猜是有道理的,但它使这些最新的两种MS技术完全不兼容,我很难相信。
值得注意的是,我们曾经使用HttpRuntime.Cache来满足我们的缓存要求,并且从来没有遇到任何问题。
任何帮助,非常感谢 - 谢谢。
I am using the releast version of AppFabric (as of 20 Oct 2010) against an Entity Framework 4 Code-First data model. As part of this, we are drawing items from SQL into POCO objects and storing those objects in AppFabric. We can store/retrieve items with no problems.
When I recompile the code and try to retrieve an item (which I know is still in the cache), I get the following exception:
"The deserializer cannot load the type to deserialize because type 'System.Data.Entity.DynamicProxies.ACMEVersionHisto_0274F07D5CB3ECB757E0533C2AD895AD967B6E8D00FAB202E813E9C48E9493A5' could not be found in assembly 'EntityFrameworkDynamicProxies-ACME.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used."
I believe that the dynamic proxy classes used by EF4 to support the POCO model are recompiled with different signatures which are not backwards compatible with those items still stored in the cache - even though the structure of the class remains unchanged (ie same properties/fields/etc). Makes sense I guess, but it makes these latest two MS technologies completely incompatible, which I find hard to believe.
Of note, we used to use the HttpRuntime.Cache for our caching requirements, and never had any problems.
Any help, much appreciated - thanks.
这篇关于由于DynamicProxies,AppFabric因EF4(实体框架)代码优先模型而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!