Questions tagged [unity-container]
The Unity Application Block (i.e. Unity) is a lightweight, extensible dependency injection container for .NET with support for interception.
13 questions
2
votes
0
answers
566
views
How to use single child Unity container for OWIN middleware and WebAPI
I am using OWIN to self host a WebAPI service. There is Unity to serve as an IoC container. Within several OWIN middlewares (e.g. authorization layer) as well as in WebAPI I need to access a Unity ...
9
votes
1
answer
13k
views
Factory pattern along with DI using Unity container
I am learning design patterns and this is my sample code where I have implemented Factory pattern and instance creation I have delegated to Unity container Framework(DI) to build the loosely coupled ...
1
vote
1
answer
1k
views
Unit test Web API controller that uses a static helper class which uses app config setting
I have a situation where I have a static class that reads my application configuration file for some configuration value. When unit testing Web API controllers that make use of this static class I am ...
2
votes
0
answers
1k
views
Identity repository pattern with UnitOfWork, GenericRepository and Unity
I created an application from 3 layers, DAL, BLL, and Representation layer in ASP.NET Web API. In DAL i have 4 Classes:
- DatabaseContext.cs, UnitOfWork.cs, GenericRepository and UserInfo. In BLL i ...
3
votes
1
answer
595
views
Unity Repository Best Practices
I am now developing a product, which will use Unity & Repositories when it comes to data management. I will demonstrate on a simple example. What we want to do, ...
3
votes
3
answers
5k
views
Unity Lazy Resolve Implementation
I have been using Microsoft.Unity as my container and have decided that the approach for a lazy implementation causes too much rework. Each time you decide to swap ...
5
votes
1
answer
1k
views
Unity and an IoC for Settings
After a somewhat lengthily discussion in the chat room, I have set up an IoC container with Unity to store my settings in.
This is my static IoC class:
...