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
7
votes
2 answers

Where can I find up to date StructureMap documentation?

http://docs.structuremap.net/ seems to have very old examples that use deprecated members. Is there a place where I can find up to date StructureMap doco ?
nixon
  • 1,952
  • 5
  • 21
  • 41
7
votes
1 answer

How can I get an instance in StructureMap Registy constructor?

How can I get an instance of some type (registered in a different Registry) inside StructureMap Registy constructor? I want to use such a code: public RepositoriesRegistry() { IApplicationSettings lApplicationSettings = …
Mike Eshva
  • 1,078
  • 15
  • 17
7
votes
2 answers

Structure Map - I dont want to use the greediest constructor!

I am trying to configure the NCommon NHRepository in my project with Structure Map. How do I stop it from choosing the greediest constructor? public class NHRepository : RepositoryBase { public NHRepository () {} …
superlogical
  • 14,332
  • 9
  • 66
  • 76
6
votes
1 answer

StructureMap Interceptors

I have a bunch of services that implement various interfaces. eg, IAlbumService, IMediaService etc. I want to log calls to each method on these interfaces. How do I do this using StructureMap? I realise this is pretty much the same as this question…
Derek Ekins
  • 11,215
  • 6
  • 61
  • 71
6
votes
2 answers

Is StructureMap dead?

Last commit was on august 28, 2011 There are 21 open issues There is no activity since august I doubt to use it in my new project What do you think about it?
VoimiX
  • 1,180
  • 3
  • 16
  • 31
6
votes
2 answers

MVP pattern using webforms and DI object instantiation

I am using the generic repository pattern to persist my data. On the PageLoad, I am creating a new Repository (from IRepository) object, and on PageUnload, I dispose of it. Should the MasterPage/Page be in charge of instantiating the objects to…
Steve Wright
  • 2,481
  • 3
  • 26
  • 35
6
votes
2 answers

Structuremap - How to register certain types in certain layers

I am using the Registry DSL example to configure structuremap. But doing this makes all of my registered types available in all layers of my application where I add a refernce to structure map. I dont want my business layer to know anything about my…
Colin Pear
  • 3,028
  • 1
  • 29
  • 33
6
votes
1 answer

StructureMap Error: No Default Instance defined for PluginFamily

very new to Structure-Map. trying to figure it out how it works and how can i benefit from it. i have got this so far.. Global.asax.cs: IContainer container = new Container(x => { x.For().Use …
6
votes
2 answers

StructureMap, configure using container or objectfactory?

I did my configuration like this: var container = new Container(x => { x.For().Use(); …
codecompleting
  • 9,251
  • 13
  • 61
  • 102
6
votes
1 answer

StructureMap Specifying Explicit Constructor Arguments

I'm working on legacy code. I have different methods of the same class that pass different arguments to the constructor of a dependency. I'm trying to get some basic IoC usage introduced. Right now I have StructureMap passing my arguments like…
Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
6
votes
7 answers

How can one use an existing instance to select a type to create in an IoC container

this is probably just a newbie question, but I have the following: public class FooSettings {} public class BarSettings {} public class DohSettings {} // There might be many more settings types... public interface IProcessor { ... } public class…
nietras
  • 3,949
  • 1
  • 34
  • 38
6
votes
3 answers

Structuremap PerRequest lifecycle

I want to inject an instance into structuremap on the fly (i.e. outside of a registry/configuration) that lives for the life of the request. Currently I'm doing this in the HandleBeginRequest event of an IHttpModule: container.Configure(x =>…
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
6
votes
4 answers

Presenter injection in Model-View-Presenter pattern with StructureMap

I've implemented my own copy of the model view presenter pattern (in vein of web client software factory) so I can leverage my own DI framework instead of being tied to WCSF's ObjectBuilder which I had numerous problems with. I've come up with a few…
Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
6
votes
2 answers

How to map same interface to different ConcreteClasses with StructureMap?

When Controller1 is being created, I want that IService will be mapped to ConcreteService1 and IPageService to ConcretePageService1 And when Controller2 is created, I want that IService will be mapped to ConcreteService2 and IPageService to…
theateist
  • 13,879
  • 17
  • 69
  • 109
6
votes
2 answers

StructureMap 'conditional singleton' for Lucene.Net IndexReader

I have a threadsafe object that is expensive to create and needs to be available through my application (a Lucene.Net IndexReader). The object can become invalid, at which point I need to recreate it (IndexReader.IsCurrent is false, need a new…
Gareth D
  • 885
  • 1
  • 9
  • 22