Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Castle.Windsor;
- using Common;
- namespace CrossCuttingConcerns
- {
- public interface IRequestProcessor
- {
- void Process<TRequest>(TRequest request) where TRequest : IRequest;
- }
- class RequestProcessor : IRequestProcessor
- {
- readonly IWindsorContainer container;
- public RequestProcessor(IWindsorContainer container)
- {
- this.container = container;
- }
- public void Process<TRequest>(TRequest request) where TRequest : IRequest
- {
- var command = container.Resolve<ICommand<TRequest>>();
- try
- {
- command.Execute(request);
- }
- finally
- {
- container.Release(command);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement