decorator-chaining

registering open generic decorators for typed implementations in castle windsor

那年仲夏 提交于 2019-12-29 09:24:22
问题 While trying to coerce Windsor into wrapping an implementation with a random number of decorators, i've stumbled upon the following: i have 3 decorators and an implementation all using the same interface. if you run this code, windsor resolves icommandhandler<stringcommand> as implementation , which, as far as i can tell, is expected behaviour, because the typed implementation can not be registered with the open typed decorators. However, if you uncomment the line container.Register(Component

Decorator Chaining of Repositories and Specialized Repositories with Dependancy Injection

笑着哭i 提交于 2019-12-11 09:48:38
问题 Right now I'm trying to figure out a way to do things smarter, and in the course of doing so all i've managed to do is use a full bottle of excedrin in a single day. Assume i have an interface called IRepository like so. public interface IRepository<T> { T Get(int id); void Add(T value); void Update(T value); void Delete(T value); ... } And assume i have an implementation like public class NHibernateRepository<T> { ... } Now, all is fine and good, i can do all my basic operations against the

registering open generic decorators for typed implementations in castle windsor

白昼怎懂夜的黑 提交于 2019-11-29 16:57:40
While trying to coerce Windsor into wrapping an implementation with a random number of decorators, i've stumbled upon the following: i have 3 decorators and an implementation all using the same interface. if you run this code, windsor resolves icommandhandler<stringcommand> as implementation , which, as far as i can tell, is expected behaviour, because the typed implementation can not be registered with the open typed decorators. However, if you uncomment the line container.Register(Component.For<ICommandHandler<stringCommand>>().ImplementedBy<Decorator1<stringCommand>>()); , all three