Top "Unity-container" questions

The Unity Application Block (i.e. Unity) is a lightweight, extensible dependency injection container for .NET with support for interception.

Best Practices for IOC Container

I'm using the Unity IOC container and I'm just wondering what is the best best way to access the container …

c# inversion-of-control unity-container
Using ASP.NET Session for Lifetime Management (Unity)

I am considering using Unity to manage the lifetime of a custom user class instance. I am planning on extending …

c# asp.net session unity-container
How to pass Owin context to a Repo being injected into Api controller

I've got a MVC WebApi owin (soft hosted) project, that uses Unity for resolving controller dependencies which look like this …

c# unity-container asp.net-web-api2 owin
Is there TryResolve in Unity?

How can I make Unity not to throw ResolutionFailedException if Resolve fails? Is there something like TryResolve<IMyInterface>? …

c# unity-container ioc-container
Register null as instance in Unity container

I have a repository class with optional dependency: class MyRepository : BaseRepository, IMyRepository { public MyRepository(IDataContext dataContext, ICacheProvider cacheProvider = null) : base(…

c# .net unity-container
Prism 6 with Unity - resolving view models for views without naming convention

I am trying to have view models resolved using DI with Prism 6 and Unity in my WPF app and this …

c# wpf mvvm unity-container prism-6
ResolveAll not working

I have a code which look something like this. When trying to do a ResolveAll I expected every type registered …

c# unity-container
Using Unity in WPF

I have Unity 2.0 working well within the App.xaml.cs to register and resolve within that class. The question I …

c# wpf unity-container ioc-container unity2.0
How to implement this (HttpContext) dependency in Unity?

we have a class with a dependency to the HttpContext. We've implemented it like this: public SiteVariation() : this(new HttpContextWrapper(…

c# asp.net inversion-of-control unity-container httpcontext
Unity IOC Buildup vs Resolve?

I was wondering when do I use buildup and when do I use resolve, when using the Unity IOC. And …

.net unity-container ioc-container