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

Structure map calling dispose multiple times when using nested container

Dispose on object instances getting called twice when disposing the nested container at the end of the httprequest. However, controller dispose called once correctly. Below is detailed info on issue. Kindly advice. Running Webapi+Owin Startup.cs …
user1424876
  • 133
  • 1
  • 7
0
votes
1 answer

StructureMap 4 constructor dependency with named instance

I want to implement the decorator pattern using StructureMap 4. I've created an interface IDeveloper and two implementations CSharpDeveloper which is the decorated type, and DeveloperDecorator which is the decorator. The decorator type has a…
Sagi
  • 8,972
  • 3
  • 33
  • 41
0
votes
1 answer

structuremap objectfactory life time

i've been using structuremap since a couple of months. I always use ObjectFactory.GetInstance to take the right instance of the object i've to use. Actually, i need to understand which is the default ObjectFactory's InstanceScope. Is it…
frabiacca
  • 1,402
  • 2
  • 16
  • 32
0
votes
1 answer

StructureMap profiles and web requests question

I want to have several different versions of my software based on a parameter passed in on the request. I'm currently trying to accomplish this with profiles. What I need to know is, if I have something like (pseudo) ObjectFactory.Profile =…
jbenckert
  • 964
  • 1
  • 10
  • 19
0
votes
1 answer

How can I get StructureMap's AutoMocker to mock fake data?

I'm currently trying to implement StructureMap's AutoMocking functionality and I need help with getting the mocked . I have a Test method as follows: [Test] public void DirctoryResult_Returns_Groups() { var autoMocker = new…
DaveDev
  • 41,155
  • 72
  • 223
  • 385
0
votes
1 answer

Wire up StructureMap with generic open type arguments

How would I wire up StructureMap with the following: public Interface IRepository{} public abstract class Repository : IRepository, other interfaces I have many concrete implementations of Repository and…
Jeremy Holt
  • 325
  • 6
  • 16
0
votes
1 answer

No parameterless constructor defined for this object during deploy

The code has DependencyInjection and already have all the required implementation. I am able to run in my machine as well as deploy in a test server. But when it is deployed in client machine where it is part of a main site. This is where this…
0
votes
1 answer

Type not being instantiated correctly by StructureMap (using XML configuration)

OK, I'm stumped over a seemingly trivial piece of functionality. How can I get StructureMap to initialize the properties on type instances retrieved from the container, using XML configuration (unfortunately I have to use XML)? My current code…
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
0
votes
1 answer

Structure Map ObjectFactory.GetAllInstances Scope

I've come across some code in the Application_EndRequest event and I'm trying to work out how it will behave: var services = ObjectFactory.GetAllInstances(); Does this return all instances in the container? Given that there is a single…
0
votes
1 answer

Resolving and registering RequestContext in WebApi using StructureMap

I successfuly configured FluentValidator (FluentValidationModelValidatorProvider) in WebApi 2 to do validation when validator exist for web api method parameter. Now I would like to implement validation in custom AbstractValidator class. I need…
marcinn
  • 1,879
  • 2
  • 22
  • 46
0
votes
1 answer

StructureMap and named instances

I'm not sure why the following doesn't work. StructureMap tells me there is no default dependency defined for SomeClassWithDependencies...um...dependencies. Can anyone shed any light on this? I want to construct the object through the entire…
jbenckert
  • 964
  • 1
  • 10
  • 19
0
votes
2 answers

how to scan another library with structure map

I have a class library that called ServiceLayer which contains the below code: IProductService.cs public interface IProductService { void AddNewProduct(Product product); IList GetAllProducts(); } ProductService.cs public class…
kamal
  • 237
  • 1
  • 5
  • 18
0
votes
1 answer

Structure Map 2.6.1

In my current project I'm currently trying to replace the Windsor IoC in favour of structure map (2.6.1). But having a bit of problem registering some generic types. How would I register IFilterConverter to use FilterConverter.…
Simon Lomax
  • 8,714
  • 8
  • 42
  • 75
0
votes
1 answer

Team Build sends error when trying to compile a Structuremap method

I'm getting a strange error when trying to compile a solution that is using StructureMap on Team Build. When I try to compile the solution locally on Visual Studio it works fine, but when trying to queue a new build in Team Build I get the following…
Gimly
  • 5,975
  • 3
  • 40
  • 75
0
votes
1 answer

How to coerce using direct class structuremap

I have a problem with writing valid configuration for my classes. Suppose that I Have: interface IA{} class abstract A : IA {} class A1 : A, IA { private readonly IB _ib; public A1(IB ib) { _ib = ib; } } class A2 : A,…
MNie
  • 1,347
  • 1
  • 15
  • 35