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
0
votes
1 answer

Bootstrapping AutoMapper & StructureMap via ConstructServicesUsing

How to tell AutoMapper 5 to use StructureMap for constructing services without creating a bootstrapping problem, i.e. new MapperConfiguration(cfg => cfg.ConstructServicesUsing(some_IContainer)) when the config is being made via StructureMap? Custom…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
0
votes
0 answers

How can I resolve an instance based on a open generic type?

Currently I'm trying to reimplement some code code written in Castle Windsor in structuremap. This code: Component.For(typeof(IMongoCollection<>)) .UsingFactoryMethod( (k, c) => MongoResolver.ResolveCollection(k, c.RequestedType))); Does the…
Patrick
  • 2,730
  • 4
  • 33
  • 55
0
votes
0 answers

How to get service instance in integration test class using structuremap 4.4

using asp.net core(1.1) and structuremap (v4.4), I want to get instance of my dbContext (to insert seed data, etc.) how can I get instance of my dbContext? I saw that the normal way is to inject IContainer container into the class constructor, but…
0
votes
1 answer

How to setup a override registration in Structuremap 4.4

So I have container in which i add a registry that defines a default type for a class. TestRegistry : Registry{ For.Use(); } this registry is added at the start of a web service during initialization of the application. directly…
kmacdonald
  • 3,381
  • 2
  • 18
  • 22
0
votes
1 answer

Why are my plugin-types only being registered partially in this case?

I am trying to implement a plugin architecture for our WPF program following the proposed implementation here. I want my plugins to reside in a separate folder from the main program folder. I have gotten it to only partially work. Here is the…
packoman
  • 1,230
  • 1
  • 16
  • 36
0
votes
1 answer

Using AssembliesFromPath from StructureMap throws MissingMethodException

I am trying to scan all assemblies in a subfolder of my main project and then add the contained registry to my main registry in order to override default registry entries, where necessary and intercept types for dependency injection. For this I…
packoman
  • 1,230
  • 1
  • 16
  • 36
0
votes
1 answer

Configure per request / nested container StructureMap using asp.net core

I am trying to scope my services per on a per request basis, but my injected services always seem to be scoped to the parent/root container, and subsequent requests see the state from a previous request. I've setup a custom StructureMap container in…
0
votes
1 answer

StructureMap could not load assembly from file in a plugin framework

I'm using StructureMap to load Plugins at the start of my application. At application startup, when I create the container I do a simple scan like: internal static IContainer Init() { var container = new Container(a => { a.Scan(scan…
Jeff Sheldon
  • 2,074
  • 1
  • 14
  • 23
0
votes
1 answer

In StructureMap 4, why might using a lambda-created default instance result in a NotSupportedException?

I'm in the process of migrating to StructureMap 4 (specifically version 4.0.1.318). I have what looks to me like appropriate object registration: For().Use(() =>…
Richard J Foster
  • 4,278
  • 2
  • 32
  • 41
0
votes
1 answer

StructureMap: How to send the container to a class that has a Constructor that does not accept Parameters

I am trying to find out how I can pass the StructrueMap container to a class that I wrote that inherits from another (MS-Class). namespace TheNamespace { public class DatabaseIssuerNameRegistry : ValidatingIssuerNameRegistry { /* **This…
CodeHacker
  • 2,127
  • 1
  • 22
  • 35
-1
votes
1 answer

Initializing a StructureMap container in Application_Start but it's null in Application_BeginRequest

In my WebApiApplication I'm trying to initialize an IContainer in Application_Start and store it in _container field: public class WebApiApplication : System.Web.HttpApplication { private IContainer _container; public IContainer Container …
Scott Baker
  • 10,013
  • 17
  • 56
  • 102
1 2 3
4