基本上,我要说的是HttpContext的内容。 现任。 用户 我请我发言。 这是结构法典:
ForRequestedType<IPrincipal>()
.CacheBy(InstanceScope.Hybrid)
.TheDefault.Is.ConstructedBy(ctx => HttpContext.Current.User)
我如何在团结中实现同样的目标?
基本上,我要说的是HttpContext的内容。 现任。 用户 我请我发言。 这是结构法典:
ForRequestedType<IPrincipal>()
.CacheBy(InstanceScope.Hybrid)
.TheDefault.Is.ConstructedBy(ctx => HttpContext.Current.User)
我如何在团结中实现同样的目标?
可以用团结2.0的投射法或前几版团结法的静态扩展来做到这一点。
var container = new UnityContainer(); // unity 2.0
container.RegisterType<IPrincipal>(new InjectionFactory(_ => HttpContext.Current.User));
I have a domain model that uses IoC with Microsoft Unity. For the validation I use VAB and I decorate the interface, not the entity. The code the following: interface IJob : IValidable { [...
I m tryingot get started with IoC, I have an MVC project in which is use subsonic, I m trying to inject subsonic simplerepository to my controllers but I m getting this error: StructureMap Exception ...
I m new to the world of IoC and having a problem with implementing it in a Winforms application. I have an extremely basic application Winform application that uses MVC, it is one controller that ...
Possibly a stupid question, but during debug I simply want to see the types that have been registered with my Unity container. I have tried going through the container in the watch window, but can t ...
I have an ASP.NET page that implements my view and creates the presenter in the page constuctor. Phil Haack s post providing was used as the starting point, and I ll just the examples from the post ...
In past couple of days, I have read about quite a lot about dependency injection/inversion of control/inversion of dependency. I think that, now my understanding of the concept is much better. But I ...
I am registering some wrapers over un-managed objects in container. How can I dispose of them at the end of the container s lifetime? Please bear in mind I have an XML Web service.
Are there facilities in NInject that will allow me to load services from other modules (assemblies) on demand like it s done in Unity?