Hi,
Well it will Resolve, but at some point you need to concertize
your ReadCommandHandler with typed generics.
here's modification to your example:
[TestFixture]
public class GustavoMickiewiczIssue
{
public abstract class Filter { }
public abstract class Entity { }
public class MyFilter : Filter { }
public class MyEntity : Entity { }
public interface ICommandHandler<T1, T2> { }
public interface IReadCommand<T> { }
public *abstract* class ReadCommandHandler<TEntity, TFilter> :
ICommandHandler<IReadCommand<TFilter>, IEnumerable<TEntity>>
where TEntity : Entity
where TFilter : Filter { }
* public class ReadCommandHandler1 : ReadCommandHandler<MyEntity,
MyFilter> { }*
[Test]
public void Resolve_ICommandHandler_NotNull()
{
// Arrange.
var container = new WindsorContainer();
container.Register(Classes.FromThisAssembly().BasedOn(typeof(ICommandHandler<,>)).WithService.AllInterfaces());
// Act.
var result =
container.Resolve<ICommandHandler<IReadCommand<MyFilter>,
IEnumerable<MyEntity>>>();
// Assert.
Assert.That(result, Is.Not.Null);
}
}
W dniu piątek, 9 stycznia 2015 04:41:11 UTC+1 użytkownik Gustavo Mickiewicz
napisał:
>
> If i use one-by-one component registration everything resolves ok.. my
> problem is fluent registration, any thoughts?
>
> Example
>
> public class MyFilter:Filter {}
>
> public class MyEntity:Entity {}
>
> public class ReadCommandHandler<TEntity,TFilter> : ICommandHandler<
> IReadCommand<TFilter>, IEnumerable<TEntity>> where TEntity : Entity where
> TFilter : Filter
>
>
>
>
> Installer
>
> container.Register(Types.FromThisAssembly().BasedOn(typeof(
> ICommandHandler<,>)).WithService.AllInterfaces());
>
>
>
>
> this results in (debugger view)
>
> ReadCommandHandler<·TEntity·, ·TFilter·> / ICommandHandler<
> IReadCommand<·TFilter·>, IEnumerable<·TEntity·>>
>
>
>
> so it seems is ok .. but then if i tried this
>
> var biz = container.Resolve(typeof(ICommandHandler<IReadCommand<
> MyFilter>,IEnumerable<MyEntity>>))
>
>
>
> or this
>
> var biz = container.Resolve(typeof(ICommandHandler<IReadCommand<Filter
> >,IEnumerable<Entity>>))
>
>
>
> the result is "No component for supporting the service"
>
> whats the matter with this?
>
> may be i have to use strategy GenericImplementationMatchingStrategy?
>
> thanx
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.