asp.net mvc 3 - Use Container/DependencyResolver in other dll -
I try to familiarize myself with I am integrating As you can see it is very straightforward and everything will work very well if it was not How can I reuse Or maybe there is the facilities, what is the solution to my problem? I was thinking about using the delegate function to get the event handlers, but I can not (I?) Make a generic representative that I will not need to start with concrete type at the time of assignment. Why should I use this stable class to basically increase every If someone can help me get his head around it, then I will be grateful. You should not directly refer your container to your app code. This service looks like a locator anti-pattern. The correct verb is to pass the necessary services to their objects to do their job, usually through constructor parameters. But ... if you insist on accepting a global stable, at least the model And then when you start your code you can set the MVC3 and
autofac But I had to face a small problem that I am having trouble solving the problem.
autofac with
MVC3 and all work well, pages are loading properly Dependencies are being injected and it is good. Do I have to provoke how to use
autofac for
container or
MVC for
DependencyResover class library in the project.
I am trying to create a stable class which will help me manage domain events. I just want to be able to call the method with the event parameter and everything should be handed over by this class. Here's the code:
Public Fixed IContainer Container {get; Set; } Increase Public static void & lt; T & gt; (TE) where T: IDomainEvent {foreach (eventhandler; IEnumerable & lt; EventHandlers.Handles & lt; T & gt; & gt; & gt; ()) {eventHandler.Handle (e) on eventEdemainEvent {foreach (DomainEventManager.Container.Resolve & lt; ); }}
MVC approach, some of my dependencies, Regions are registered as code> InstancePerHttpRequest (
NHibernate 'session), while others are registered in
InstancePerDependency or
SingleInstance . Thus, when I try to use the
container in my UI project, I get an exception that no
httpRequest tag is not available.
the container created in the web project to get access to all of
InstancePerHttpRequest and
HttpRequest tag?
entity and
total or
service to create domain events should be there. In each of these, it will be difficult to inject the code
Cheers, Paco EventManager as a singleton, then such an experiment looks:
EventManager.Current.Raise & LT; SomeEvent & gt; (SomeObject);
EventManager.Current equal to the example that is prepared properly.
Comments
Post a Comment