unity-container Questions

1

I have two questions. I installed Unity and Unity MVC packages to start investigating it. I got some simple controller constructor injection working by registering some types, so it's going well. I...
Bunker asked 14/11, 2017 at 1:26

6

Solved

I have an ASP.NET web application that I created from Visual Studio 2015 Community Edition. The .NET Framework is 4.6.1. I have no idea which version of ASP.NET my web application is using ASP.NET...
Lubricate asked 25/7, 2016 at 14:14

4

I am using Unity here. But probably we just need to be pointed to a right direction. We know how to inject an interface: public class AccountController:ApiController { private readonly IAccount...
Diglot asked 28/8, 2014 at 18:1

10

Solved

We have an ASP.NET MVC 4 web app that uses SQL Server 2012 and Entity Framework as ORM and Unity for IoC. Web app is hosted on Amazon EC2. I started getting "Physical connection is not usable&...

8

Solved

I am using Microsoft's Unity for dependency injection and I want to do something like this: IDataContext context = _unityContainer.Resolve<IDataContext>(); var repositoryA = _unityContainer...

3

Solved

How do I registertype with the container where the type doesn't have NO PARAMETER constructor. In fact my constructor accepts a string, and I normally pass in a string that represents a Path. So ...
Seethe asked 23/10, 2010 at 8:36

2

Solved

This is my dad class public class Dad { public string Name { get;set; } public Dad(string name) { Name = name; } } This is my test method public void TestDad() { UnityContainer Dad...

6

Solved

For the following "project" I am getting a very annoying and inexplicable error when resolving Unity for DI. InvalidOperationException - The type LogWriter cannot be constructed. You must confi...
Zerk asked 18/10, 2012 at 8:44

4

Solved

I found this demo article on Unity. Looks pretty straightforward but I'm getting the following error: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, ...
Optician asked 31/1, 2019 at 21:16

4

Solved

I just starting with Unity Container and my registration looks like this: static void UnityRegister() { _container = new UnityContainer(); _container.RegisterType<IBook, Book>(); _contain...
Entomb asked 8/9, 2015 at 4:4

6

Solved

I'm trying to Mock the IUnityContainer using Moq 3.0 I'm getting a BadImageFormatException, but not when debugging. From the looks of it I'm not the only one that's ran into this problem. here A...
Hampson asked 16/3, 2009 at 16:5

3

Solved

Using the code block below as reference, a single update provides the following results: intReturn = 0 inputArrayReturn = 1 internalArrayReturn = 1 The only value that makes sense to me here is int...

3

Solved

If I surf to http://localhost:58472/Account/Register I've this exception System.InvalidOperationException: The current type, IUserStore<ApplicationUser>, is an interface and cannot be con...

4

Solved

We're using Unity as our dependency injection framework. I want to create an acceptance test and need an instance of DossierService. Unfortunately I get the following exception: BoDi.ObjectCont...
Richelieu asked 22/9, 2017 at 6:22

4

Solved

I am trying to register a generic ILogger (from Microsoft.Extensions.Logging, not from Serilog) in Unity (version 4). I've got the following class: public class MyClass { private readonly Micros...
Sanatorium asked 8/4, 2019 at 12:3

2

Solved

How do I inject dependencies into the global.asax.cs, i.e. the MvcApplication class? Having previously used the Service Locator (anti-)pattern for dependency injection, I am trying to follow best ...
Linen asked 13/10, 2011 at 9:26

3

Probably a Unity beginner's question: when using Unity, would you still need to implement Dispose methods on the objects you have injected? Or is even this not needed (so, done automatically by Uni...
Windtight asked 27/11, 2012 at 10:1

2

Solved

This is a small question, just to make sure I'm understanding Unity correctly. I'm using Unity in an ASP.NET MVC application, and I have registered a type as follows: container.RegisterType<I...
Fernald asked 30/10, 2014 at 10:19

3

I got this problem with the Controller: An error occurred when trying to create a controller of type '*.WebMvc.Controllers.HomeController'. Make sure that the controller has a parameterless public ...
Amboceptor asked 12/11, 2012 at 15:31

11

Solved

I have followed this tutorial which has worked great, until I modified my DbContext to have an additional constructor. I am now having issues with the resolution and not sure what to do to fix this...
Dodd asked 17/6, 2014 at 0:41

3

Solved

I am trying to inject a dependency into a custom AuthorizeAttribute as follows: public class UserCanAccessArea : AuthorizeAttribute { readonly IPermissionService permissionService; public UserC...

2

I keep getting this error, usually after changing the web.config on a running ASP.NET MVC azure web service app. It will run fine the first time but after it recompiles after changing the web.confi...

5

Solved

I'm new to Unity and am trying to write some Unity logic which initialises and register/resolves a singleton instance of the Email object so that it can be used across several other objects, one ex...
Chromophore asked 30/5, 2013 at 12:8

3

I am sort of new to Unity all seems to be fine but I am kind of lost when to use ResolvedParameter in Unity. Googled and looked on MSDN but still cannot understand when to use it. Do you have a ...
Damali asked 20/9, 2009 at 16:55

2

We have Unity+Prism WPF applications, and there is 2 folders from which we want to load dynamically the modules. I know that to load modules from a directory, I should use a DirectoryModuleCatalog...
Publicity asked 23/2, 2018 at 10:33

© 2022 - 2024 — McMap. All rights reserved.