问题描述
大家好
我有一个WF4活动,我已成功将其持久保存到Sql数据库,但是当尝试加载以前保存的实例时,我收到以下异常:
反序列化程序无法加载要反序列化的类型,因为在程序集中找不到类型"System.Activities.Location`1 [[MYTYPE,MYASSEMBLY,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]]" System.Activities,版本= 4.0.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35''.检查要序列化的类型与要反序列化的类型具有相同的协定,并使用相同的程序集.
"MYTYPE"类是MYASSEMBLY中包含的POCO.
感谢收到的任何帮助,
谢谢
Hi all
I have a WF4 activity which I am successfully persisting to an Sql database, however when attempting to load the previously persisted instance I receive the following exception:
The deserializer cannot load the type to deserialize because type ''System.Activities.Location`1[[MYTYPE, MYASSEMBLY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'' could not be found in assembly ''System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35''. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used.
The "MYTYPE" class is a POCO contained within MYASSEMBLY.
Any help gratefully received,
Thanks
推荐答案
private Assembly AppDomain_AssemblyResolve(object sender, ResolveEventArgs e)
{
if (e.Name == "MYTYPE, MYASSEMBLY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
{
return Assembly.Load("MYTYPE, MYASSEMBLY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
}
return null;
}
这篇关于工作流程4持久性,反序列化错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!