2
ジェネリック型トラフのUnityを解決しようとしていますが、エラーが発生しています:{"指定されたアセンブリ名またはコードベースが無効です(例外:HRESULT:0x80131047)":null} 。Unityのジェネリック型を解決する方法
マイコードと構成は以下の通りである:
namespace Prj.Common.Workflow
{
public class ServiceActivityBase<I, O> : CodeActivity, IServiceActivityBase
{
}
}
namespace Prj.Services
{
public sealed class TestActivity : ServiceActivityBase<InputDto, OutputDto>
{
}
}
namespace Prj.Dto
{
public class InputDto {}
public class OutputDto {}
}
各名前空間は、名前空間と同じ名前を持つ別asssemblyに配置されます。私は、web.configファイルに次の登録があります。
<register type="Prj.Common.Workflow.ServiceActivityBase'2[[Prj.Dto.DajDetailDietetickejPotravinyVstupDto,Prj.Dto],[Prj.Dto.DajDetailDietetickejPotravinyVystupDto,Prj.Dto]], Prj.Common.Workflow"
mapTo="Prj.Services.TestActivity, Prj.Services"
name="TestActivity"
>
<constructor/>
<interceptor type="VirtualMethodInterceptor"/>
<policyInjection />
</register>
コンフィギュレーションのロード中に、私はエラーを受信しています:
IUnityContainer container = new UnityContainer().LoadConfiguration();
を誰かが助けることはできますか?
ありがとう
このhttp://blogs.microsoft.co.il/blogs/gilf/archive/2008/07/25/working-with-generic-types-in-unity-configuration-section.aspxは役に立ちますか? –
Unity v3.5の自動登録の完全な例については、http://stackoverflow.com/questions/17168458/unity-autoregistration-convention-based-registration-unity/25654904#25654904を参照してください。 – Contango