Questions tagged [structuremap]

StructureMap is a Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2.

StructureMap is a Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2. It can be found at https://structuremap.github.io/.

Installation

StructureMap can most easily be installed through its NuGet package.

Install-Package structuremap

Links

Related

1728 questions
0
votes
1 answer

StructureMap and classes that cannot accept constructor arguments

I have a ASP.NET web application (not MVC) which is actually a CMS application. I'm trying to set up StructureMap IoC framework and it's working well, but I've now hit a blocker in my understanding. In my understanding, StructureMap enforces a…
0
votes
1 answer

StructureMap - Register a singleton for multiple interfaces

I want to register some animals as singletons, so I wrote a structure map registry with the following code: this.For.Use().Singleton(); this.For.Use().Singleton(); ILion and IElephant derive from IAnimal and I also…
Tho Mai
  • 835
  • 5
  • 25
0
votes
0 answers

My class extends from 4 different interfaces. How to register and resolve using Structuremap IoC container

I have 2 class say public class Master : IService public class Settings : ISettings In constructor of Settings class I am calling, var cache = ObjectFactory.GetInstance(); I am registering in one StructureMap registry class constructor…
0
votes
1 answer

Should I use StructureMap or Session to manage a concrete instance?

I am using StructureMap on an ASP.NET MVC project. I have an object that I want to use throughout the session. Should I use StructureMap or Session:["MyObject"] to manage the concrete instance? Thanks in advance.
Tarzan
  • 4,270
  • 8
  • 50
  • 70
0
votes
2 answers

SetAllProperties method missing in structuremap Registry

I have a fairly old project that needs some work doing on it, i have run update-package in nuget and now get the following in my TypeRegistry The name 'SetAllProperties' does not exist in the current scope The TypeRegistry is as follows public…
Neil Stevens
  • 3,534
  • 6
  • 42
  • 71
0
votes
2 answers

Windows Azure Error - Could not load file or assembly MFCMIFC80

I have created an Angular/WebAPI/MongoDb project and using StructureMap for dependency injection and I have it published to a private BitBucket account. I have create an Azure Webapp and set it up to auto deploy whenever I commit a change to my…
jkruer01
  • 2,175
  • 4
  • 32
  • 57
0
votes
1 answer

Default to Always Unique for unregistered concrete types

Consider this code var container = new Container(); var nested = container.GetNestedContainer(); var f1 = nested.GetInstance(); var f2 = nested.GetInstance(); var result = f1 == f2; //I want result to be false I don't want to register…
Anders
  • 17,306
  • 10
  • 76
  • 144
0
votes
1 answer

How do I configue StructureMap to create a DbConnection

I have the code below for my Entity Framework context. I am using the overloaded constructor to inject in an in memory database for testing. This works fine but when I use this in my MVC app I need to configure StructureMap for the DbConnection. I…
Dave Amour
  • 155
  • 1
  • 13
0
votes
1 answer

Context while loading Assemblies via Structuremap

I want to load plugins in a similar way as shown here however the loaded assemblies seem not to share the same context. Trying to solve the problem I just build a tiny spike containing two assemblies. One console app and one library. The console app…
Zebi
  • 8,682
  • 1
  • 36
  • 42
0
votes
1 answer

Resolve Child class dependency using structure map

I am trying to resolve dependencies using structure map.How do I resolve all child class dependencies automatically by resgitering the base interface using structure map. Conside the following example. I dont want to register UserHandler,…
DotNetLearner
  • 95
  • 2
  • 13
0
votes
2 answers

Inject ISession into custom valueresolver

I'm trying to inject an instance of ISession into a custom AutoMapper ValueResolver. Here's the resolver public class ContactTypeResolver : ValueResolver { ISession _session; public…
0
votes
1 answer

CloudConfigurationManager.GetSetting fails during StructureMap Controller Injection

All of a sudden I started getting the typical Structure Map error stating, "No parameterless constructor defined for this object". This is a common error and usually means that something is wrong with the object being injected. In my case, the…
0
votes
2 answers

Using StructureMap, how do you explicitly trigger the reinstantiation of a object with InstanceScope.Singleton?

I have an integration test harness where I want to teardown and then re-instantiate some of the singleton-scoped objects I've registered with StructureMap, after and before each test. This way I can simulate the actual run time environment, but…
0
votes
1 answer

How to swap StructureMap named instance?

Sample code: public interface IMyClass { string Name { get; set; } } public class MyClass : IMyClass { public string Name { get; set; } } public static class Program { public static void Main() { var container = new…
0
votes
1 answer

structuremap configuration asp.net mvc 4

I have a problem with MVC4 StructureMap configuration, when I run the project the compiler fires this error No Default Instance defined for PluginFamily Mace_CrmSystem.Controllers.HomeController this is my code global.aspx code namespace…
Mo Haidar
  • 3,748
  • 6
  • 37
  • 76