Agatha の IoC コンテナーへの StructureMap 3.0 ラッパーの実装で Agatha RRSL を使用したいと考えています。Agatha には、私が気に入らない StructureMap 2.6 の NuGet パッケージがあります。
まず、Agatha.StructureMapソース コードからコードをコピーして貼り付け、 3.0 StructureMap を使用するように変更を加えました。
私が今抱えている問題は、StructureMapExceptionが発生することです
StructureMap.StructureMapBuildPlanException occurred
_HResult=-2146233088
_message=Unable to create a build plan for concrete type Agatha.Common.WCF.RequestProcessorProxy
HResult=-2146233088
IsTransient=false
Message=Unable to create a build plan for concrete type Agatha.Common.WCF.RequestProcessorProxy
new RequestProcessorProxy(InstanceContext, String endpointConfigurationName, String remoteAddress)
┗ InstanceContext = **Default**
String endpointConfigurationName = Required primitive dependency is not explicitly defined
String remoteAddress = Required primitive dependency is not explicitly defined
Source=StructureMap
Context=new RequestProcessorProxy(InstanceContext, String endpointConfigurationName, String remoteAddress)
┗ InstanceContext = **Default**
String endpointConfigurationName = Required primitive dependency is not explicitly defined
String remoteAddress = Required primitive dependency is not explicitly defined
Title=Unable to create a build plan for concrete type Agatha.Common.WCF.RequestProcessorProxy
StackTrace:
at StructureMap.Pipeline.ConstructorInstance`1.ToBuilder(Type pluginType, Policies policies) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Pipeline\ConstructorInstance.cs:line 83
InnerException:
これは、コンストラクター StructureMap が使用する必要があると考えているように見えますが、適切に構成されていないビューは、複数のパラメーターを持つビューです。実際には、パラメーターなしのコンストラクターを使用する必要があります。
ただし、コンストラクターを適切に構成したと思います。RequestProcessorProxy のパラメーターなしのコンストラクターを構成するために使用するコードを次に示します。
structureMapContainer.Configure(x => x.ForConcreteType<RequestProcessorProxy>().Configure.SelectConstructor(() => new RequestProcessorProxy()));
何がうまくいかなかったのでしょうか?
私は StructureMap と Agatha の両方に慣れていないので、上記の一部またはすべてを誤解している可能性があります...