Questions tagged [structuremap4]

Version 4 of the StructureMap - Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2.

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

Related

56 questions
1
vote
1 answer

Implement multiple-implementations-of-the-same-interface using structure map and call specific class

I am using structure map IOC container I am not using the scan with default name convention here. public interface ICompanyRepository { IEnumerable GetAll(); Company Get(int id); Company Add(Company item); bool…
Kumee
  • 201
  • 1
  • 4
  • 11
1
vote
1 answer

Are these two registry entries in StructureMap identical?

I want to register a singleton class against its corresponding interface. I found two different ways to achieve this: Option 1: this.For() .Use() .Singleton(); Option 2: this.For() …
packoman
  • 1,230
  • 1
  • 16
  • 36
1
vote
0 answers

Mapping CDA to FHIR resource using hapi-Fhir StructureMap resource in Java

I am trying to map xml cda document to Fhir resources using structureMap resource. Here is structureMap resource which I programmed: StructureMap structureMap = new StructureMap(); StructureMapGroupComponent group = new…
Sohrab
  • 1,348
  • 4
  • 13
  • 33
1
vote
0 answers

Structuremap loading assemblies from sub folders

I have a service that uses application domains. A few legacy domains living in isolation and work supervised via a main process. The main application and sub processes have different IOC containers. With version 4.2.0.402 of structuremap I noticed…
rizan
  • 339
  • 1
  • 3
  • 16
1
vote
0 answers

Use nested container as IContext in Lambda function

I have a ASP.Net MVC application set up with Structuremap and StructuremapDependencyScope serving up a nested container for each request. I would like to be able to build up a list and have StructureMap return that list, for as long as the custom…
1
vote
0 answers

How do I retrieve a specific instance in the constructor, when there are multiple instances

I'm using structuremap 4.5.1. I have two instances of an interface, and I need to know how to retrieve a specific one in my constructor. So in this case, I have one class that requires one of the instances of my interface, then I have a different…
Tyler Jones
  • 1,283
  • 4
  • 18
  • 38
1
vote
1 answer

How do you resolve instances of IInterceptionBehavior from the container when using StructureMap DynamicProxyInterceptor?

I'm migrating from Unity to StructureMap. I've made some use of Unity's InterceptionBehavior. I thought I could switch that to use StructureMap .InterceptWith and the DynamicProxyInterceptor but my interceptors have dependencies and I can't work…
BenCr
  • 5,991
  • 5
  • 44
  • 68
1
vote
1 answer

Structuremap default registry dynamic values

i am trying to inject a string into structuremap registry at run time. i have successfully done it with a static string. like this For().Use().Ctor("connectionString").Is("randomStringData"); but when i am trying to make…
wandos
  • 1,581
  • 2
  • 20
  • 39
1
vote
1 answer

Resolve Dependency on a repository interface MVC5 using structuremap

I have a mapper that takes data from a repository project. I have a IMenueMapper interface that is passed into the homecontroller like this: public HomeController(IMenueMapper menueMapper) { _menueMapper = menueMapper; } but the menuemapper…
Jack M
  • 2,564
  • 4
  • 28
  • 49
1
vote
1 answer

StructureMap forwarding named instances

I am using StructureMap 4.4.1. In my code, I have 1 concrete class, TransactionalDatabaseClient, that implements ITransactionalDatabaseClient, which inherits from IDatabaseClient. I'm using the Forward method to redirect requests for…
Dan
  • 901
  • 11
  • 25
1
vote
0 answers

structuremap object reference with particular dependency

I am new to structuremap. I want to get Shopper classes object with either "master" or "visa" dependency based on user input. In below code I have created two concrete classes MasterCard and Visa from ICreditCard. I am injecting dependency of…
Shaile
  • 11
  • 1
1
vote
1 answer

Where do I register HttpContextBase for StructureMap Nested Container?

I am new to IoC and installed Nuget Package StructureMap.MVC5 into my MVC project. I am trying to register the following: For().Use(() => new HttpContextWrapper(HttpContext.Current)) Based on what I am reading I need to reference…
1
vote
0 answers

StructureMap AOP DynamicProxy

I am trying to implement AOP using StructureMap and Castle.Core. I am using the latest versions. I am able to make it with the default constructor, but what I need to inject the logger into the constructor of the IInterceptor. How can I do…
user1124707
  • 135
  • 1
  • 11
1
vote
1 answer

C# lambda in StructureMap

using StructureMap 4, and me new to C#, i wonder why i get a compilation error: var di = new Container(_ => { // (1) compile error: CS1503: Argument 1: cannot convert from 'StructureMap.IContext' to '...ITest' _.For
fbenoit
  • 3,220
  • 6
  • 21
  • 32
1
vote
1 answer

StructureMap 4 with named instances not working as expected

Here is a simplified version of a couple of classes in my solution and the interfaces they implement. They both share one interface and also implement a dedicated interface. public interface ISharedContract { void…
Tom Troughton
  • 3,941
  • 2
  • 37
  • 77