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 injection per web request

I have an ASP.NET Web Api 2 REST service with several controllers. Each one of these controllers' constructor has got an ILogger argument which I have to inject with StructureMap. Is it possibile to instantiate an ILogger per request, in order to…
lucacelenza
  • 1,259
  • 1
  • 15
  • 28
0
votes
3 answers

Does Castle Windsor have a Static Class Similar to StructureMap's ObjectFactory?

I am currently making the move from StructureMap to Castle Windsor. Using StructureMap, you can bootstrap the framework in one central location, and then call ObjectFactory.GetInstance anywhere in your code to grab an instance using that…
Phil Sandler
  • 27,544
  • 21
  • 86
  • 147
0
votes
1 answer

How to have structuremap build instance based on type

Ok so this might not be the best title but I am struggling with how to title this. Here is what I have thus far: I currently have data mappers for my objects. I define them in a registry like so. This allows me to get the type name of the object and…
spinon
  • 10,760
  • 5
  • 41
  • 59
0
votes
1 answer

Setter Property Injection don't work in static class, using ASP.NET MVC 5 and Structuremap

I create a static class Util in the library project for purpose define common method in project asp.net mvc 5, i use structuremap.mvc5, but it don't initialize the Install of IService is static property, i declare in static class. Thank you for…
Vinh Ngo
  • 47
  • 2
  • 8
0
votes
2 answers

Having a problem auto-wiring up with named instances in Structure Map

I'm new to structure map and so far having good luck. However, there's one area I'm having a bit of a problem with. This is trying to auto-wireup using named instances and the newer .For().Use() syntax. No matter what I do, I'm getting the LAST…
Jim L
  • 2,297
  • 17
  • 20
0
votes
1 answer

Many IoC dependencies in transaction-script type processes - what are we doing wrong?

We have many long-running processes that each require dozens of steps. Each step is relatively complex in its own right, so we broke those steps into their own classes. We are using DI/IoC (StructureMap) to help us make the whole thing testable. …
Beep beep
  • 18,873
  • 12
  • 63
  • 78
0
votes
1 answer

StructureMap can not find a default instance for HttpServerUtility

I have a class that relies on HttpServerUtilityBase my plan was to get structure map to use HttpServerUtilityWrapper as the default instance. Nothing odd there. However, once I've added the declarations to my registry, structuremap is unable to…
ilivewithian
  • 19,476
  • 19
  • 103
  • 165
0
votes
1 answer

How to register Interface with T is an interface in Structuremap

I have an interface IFinancialMarketRepository and the FinancialMarketRepository is FinancialMarketRepository When I register that by StructureMap with code …
Vũ Hoàng
  • 255
  • 1
  • 14
0
votes
1 answer

Specifying One of Many Constructor Parameters With StructureMap

If I have a class like so: public SomeClass : ISomeClass { public SomeClass(IInjectedDependency dependency, bool someArbitraryValue) {} } How can I set this up with SM to inject the dependency but specify the arbitrary value? I've tried the…
hcoverlambda
  • 1,240
  • 1
  • 15
  • 21
0
votes
1 answer

Setting up OrmLite with StructureMap

I want to create a basic IoC of OrmLite with StructureMap but i make something wrong. At the site of OrmLite they give a simple example how to inject it: container.Register(c => OrmLiteConnectionFactory(":memory:",…
Yoan Dinkov
  • 531
  • 1
  • 5
  • 17
0
votes
3 answers

I get an "Inconsistent Accessibility" error

public class Employee : IEmployee { private String name; private String department; private int salary; private List subordinates; public void addEmployee(String name, String department, int salary) { …
0
votes
1 answer

Azure - Structuremap. How to pass a dependency to a class that implements IEventProcessor(Event Hub)

I am using azure event hub and I am trying to work out how pass in dependencies into the EventProcessor class used to process events off the event hub in my worker role. This class inherits the .net interface IEventProcessor. My event processor…
0
votes
1 answer

Making StructureMap configurable

StructureMap, starting from version 3.0, dropped the support of XML configuration. That is, I can no longer tell StructureMap which class satisfies which interface from the configuration. Instead, I have to mention that in the code itself. This…
Husain
  • 784
  • 1
  • 9
  • 22
0
votes
2 answers

Structure Map: Get service based on meta or context information

I have two types of searches in my application: International and national search. Both have nearly the same data structures but different data sources. I've created two different repositories with the same Interface. Now I would like to request the…
HerrLoesch
  • 1,023
  • 1
  • 13
  • 24
0
votes
1 answer

StructureMap Constructor arguments without Concrete type or args by instance name

I did read other answers but none of them fully fit, so please bear with me Background pseudo code (disregard SM version) public interface IFilter() {} public class A: IFilter {} public class B: IFilter {} public class C: IFilter {} public class D:…
Pawel Cioch
  • 2,895
  • 1
  • 30
  • 29