성 구조체에 구조체 코드를 포팅하려고합니다.구조체 포트와 윈저 성
No component for supporting the service CreateTestCommandHandler was found
내가 가지 테스트 콘솔 응용 프로그램을 사용하고 있습니다 :
콘솔 응용 프로그램 :
private static IWindsorContainer _container;
...
static void Main()
{
_container = new WindsorContainer();
ApplicationBootStrapperCastleWindsor.BootStrap(_container);
...
좀 더 단축 코드 :
public class CreateTestCommandHandler : ICommandHandler<CreateTestCommand>
{
private readonly IDomainRepository<IDomainEvent> _repository;
public CreateTestCommandHandler(IDomainRepository<IDomainEvent> repository)
{
_repository = repository;
}
...
을 순간, 나는이 오류를 얻고있다
및 :
,과 :
public class DomainInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<IDomainRepository<IDomainEvent>>().ImplementedBy<DomainRepository<IDomainEvent>>());
누군가가 어떤 명백한 잘못 볼 수 있을까요? 컨테이너를 검사하면 잠재적으로 재구성 된 구성 요소에 IDomainRepository도 표시됩니다. 다음
원래 structuremap 코드 :
ForRequestedType<IDomainRepository<IDomainEvent>>()
.TheDefault.Is.OfConcreteType<DomainRepository<IDomainEvent>>();
PS :
실제 예외 (일본어 structuremap 코드 here을 발견 할 수있다) GetCorrectlyInjectedCommandHandler에 슬로우:
public class RegisterCommandHandlersInMessageRouter
{
private static IWindsorContainer _container;
public static void BootStrap(IWindsorContainer container)
{
_container = container;
new RegisterCommandHandlersInMessageRouter().RegisterRoutes(new MessageRouter());
}
private static object GetCorrectlyInjectedCommandHandler(Type commandHandler)
{
return _container.Resolve(commandHandler);
}
}
'CreateTestCommandHandler'를 등록한 코드와 오류가 발생한 코드를 표시 할 수 있습니까? –
답장을 보내 주셔서 감사합니다. 나는 원래의 질문에 적응했다 (PS 참조). 예외는 GetCorrectlyInjectedCommandHandler에서 throw됩니다. 내가 콘크리트 인 것처럼 CreateTestCommandHandler를 등록해야한다는 것에 대해 혼란 스럽다. – cs0815