Hi All,

I do not know what I am missing, tried various options but nothing
seems to work for me.
Following is the pseudocode :

public interface IDomainEventStorage<TDomainEvent> :
ISnapShotStorage<TDomainEvent>, ITransactional where TDomainEvent :
IDomainEvent
        {}

public class DomainEventStorage<TDomainEvent> :
IDomainEventStorage<TDomainEvent> where TDomainEvent : IDomainEvent
        {

        public DomainEventStorage(string sqLiteConnectionString,
IFormatter formatter)
              {}
        }

 public class TransactionHandler<TCommand, TCommandHandler>
        where TCommandHandler : ICommandHandler<TCommand>
        where TCommand : class
    {
        public TransactionHandler(IUnitOfWork unitOfWork)
        {}
    }



I am converting this from StructureMap to CastleWindsor :
Following is Structure Map's syntax used for registration :
     ForRequestedType<IDomainEventStorage<IDomainEvent>>()
                .TheDefault.Is.OfConcreteType<DomainEventStorage<IDomainEvent>>
()
                .WithCtorArg("sqLiteConnectionString").EqualTo
(sqLiteConnectionString);

ForRequestedType<IUnitOfWork>()
                .TheDefault.Is.ConstructedBy(x =>
x.GetInstance<IEventStoreUnitOfWork<IDomainEvent>>());

My syntax is :

container.Register(Component
                                .For<IDomainEventStorage<IDomainEvent>>
()
                                .ImplementedBy<DomainEventStorage<IDomainEvent>>
()
                                .LifeStyle.Transient
                                .Parameters(Parameter.ForKey
("sqLiteConnectionString").Eq(sqLiteConnectionString)));

 container.Register(
                 AllTypes.Of<IUnitOfWork>()
                     .FromAssemblyNamed("ABC").Unless(type =>
type.IsAbstract)
                     .WithService.FromInterface(typeof
(IEventStoreUnitOfWork<IDomainEvent>)));

I kept a breakpoint in the constructor it's getting initalized when my
web app starts.
But when it is required for dependency in :

  ServiceLocator.Current.GetInstance<TransactionHandler<TCommand,
TCommandHandler>>();

it throws this error :
{"Activation error occured while trying to get instance of type
TransactionHandler`2, key \"\""}

{"Can't create component
'Fohjin.DDD.EventStore.Storage.EventStoreUnitOfWork`1' as it has
dependencies to be satisfied.
Fohjin.DDD.EventStore.Storage.EventStoreUnitOfWork`1 is waiting for
the following dependencies:
Services: IDomainEventStorage`1 which was not registered.
              IIdentityMap`1 which was not registered.

Both of these services are initialized when my app starts but not when
required.

What am I missing?

Any help would be hightly appreciated.

Thanks in advance.

Thanks,
Bkak.


--

You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.


Reply via email to