unity-container Questions

2

Solved

Hi I have been having trouble trying to tell Unity that for an Interface if it has multiple implementations , I want it to inject them in different classes.Here is what I mean: Let's say I have an...
Trager asked 6/9, 2013 at 19:35

6

Solved

how do I register two different interfaces in Unity with the same instance... Currently I am using _container.RegisterType<EventService, EventService>(new ContainerControlledLifetimeManager()...
Kendo asked 8/9, 2009 at 15:26

3

In a WPF project(with prism) we are using Unity as DI framework. Recently, after we merged two big branches, we were not able to start our application, we were having StackOverflowException. Due t...
Freespoken asked 31/3, 2016 at 11:36

3

Is there a way to make Unity dispose property-injected objects as part of the Teardown? The background is that I am working on an application that uses ASP.NET MVC 2, Unity and WCF. We have writte...
Sabra asked 18/9, 2009 at 9:41

3

Solved

How to do it in code is explained here: Unity Register two interfaces as one singleton _container.RegisterType<EventService>(new ContainerControlledLifetimeManager()); _container.RegisterTyp...
Inboard asked 21/10, 2011 at 0:29

3

Solved

I have a ASP .Net Web API controller that I want to take 2 parameters. The first one is an EF context and the second being a caching interface. If I just have the EF context the constructor gets ca...

7

Solved

This helpful article from David Haydn (EDIT: scam link removed, it could have been this article) shows how you can use the InjectionConstructor class to help you set up a chain using the decorator ...
Mikiso asked 24/5, 2011 at 11:25

6

Solved

How can I make Unity not to throw ResolutionFailedException if Resolve fails? Is there something like TryResolve<IMyInterface>? var container = new UnityContainer(); var foo = container.Try...
Casserole asked 18/5, 2009 at 17:55

3

Solved

I have this class : public class Repo { public Repo() : this(ConfigurationManager.AppSettings["identity"], ConfigurationManager.AppSettings["password"]) { } public Repo(string identity,stri...
Smallsword asked 9/3, 2011 at 22:38

4

Solved

I've got a MVC WebApi owin (soft hosted) project, that uses Unity for resolving controller dependencies which look like this public class PacientaiController : ODataController { private readonl...
Epimorphosis asked 31/12, 2014 at 15:44

4

Solved

I have the following Unity related question. The code stub below sets up the basic scenario and the question is at the bottom. NOTE, that [Dependency] attribute does not work for the example belo...
Ro asked 21/8, 2018 at 0:47

5

Solved

So I was following this introduction to the Entity Framework Code First to create a new database ( https://msdn.microsoft.com/en-us/data/jj193542 ) and I followed the example completely. Now I want...
Noodle asked 4/6, 2015 at 22:53

3

How do I inject my dbContext class using Unity? I can't just create a Interface like for my other "normal" classes? What should I do with my RequestContext class and what should my UnityConfig look...
Saturniid asked 17/4, 2016 at 16:13

2

Solved

Adding EF Core to a NET Standard project introduces transitive dependency versions incompatible with NuGet packages in other projects I have a solution with multiple .NET Standard 2.0 projects. O...

3

Solved

I'm using Unity and try to follow to SOLID-principles as far as possible. Therefore all implementations only have dependencies to interfaces. I have a collectionwrapper which looks like this: pub...
Lodovico asked 11/2, 2016 at 8:29

3

Solved

I'm working at a ASP.NET Webforms project and is using Unity for DI. This project also use DevExpress ASP.NET Ajax Controls. Now we have run into problem and it seems to be a conflict between DevE...
Cockadoodledoo asked 26/1, 2015 at 15:9

2

Solved

I want to use Unity in my WPF application using VS2012, I defined unity container as follows: IUnityContainer unityContainer = new UnityContainer(); unityContainer.RegisterType<IMainViewModel, ...
Brooke asked 16/6, 2014 at 19:58

3

I have a class with constructor like this: public class Bar { public Bar(IFoo foo, IFoo2 foo2, IFoo3 foo3, IFooN fooN, String text) { } } I want to register Bar in Unity and provide a value ...
Microchemistry asked 8/8, 2012 at 14:24

5

Solved

I have a repository class with optional dependency: class MyRepository : BaseRepository, IMyRepository { public MyRepository(IDataContext dataContext, ICacheProvider cacheProvider = null) : base...
Hassanhassell asked 9/7, 2012 at 9:50

2

Solved

Why I'm I getting this error on Employee Controller rest of them are working perfectly Here is my Employee Controller public class EmployeeController : ApiController { #region Call service pr...
Disability asked 18/7, 2017 at 8:0

6

Solved

I'm using Unity for Dependencies Injection and using Identiy Provider to manage the user login, register, email confirmation, etc. When I try to register a user, I have this problem: The curren...
Vassili asked 14/7, 2014 at 7:20

1

I have a huge solution with many projects and in-house NuGet packages that has a pervasive dependency on Unity 4.0.1. We are evaluating migrating this solution to Unity 5.11.1 to improve performanc...
Phalanstery asked 12/7, 2019 at 1:34

3

I have this code: 1: IUnityContainer container = new UnityContainer(); 2: container.LoadConfiguration(); Line 1 works, but line 2 not. LoadConfiguration is not found as a member. I think, i have...
Blankly asked 1/5, 2012 at 19:7

6

I need help with this. I'm using Unity as my container and I want to inject two different instances of the same type into my constructor. class Example { Example(IQueue receiveQueue, IQueue sendQ...
Cosby asked 27/8, 2013 at 5:37

3

I am using MVC 5, WCF and Unity framework in my application. I am getting below error when I run WCF service: Server Error in '/' Application. Could not load file or assembly 'System.Web.WebPag...
Pluri asked 14/1, 2014 at 7:52

© 2022 - 2024 — McMap. All rights reserved.