Questions tagged [structuremap3]

Version 3 of the StructureMap Dependency Injection / Inversion of Control library for .NET

Home page: https://structuremap.github.io/

What’s Different and/or Improved in StructureMap 3?

Details taken from http://jeremydmiller.com/2014/03/31/structuremap-3-0-is-live/

  • The diagnostics and exception messages are much more useful
  • The registration DSL has been greatly streamlined with a hard focus on consistency throughout the API
  • The core library is now PCL compliant and targets .Net 4.0. So far SM3 has been successfully tested on WP8
  • Removed strong naming from the public packages to make the world a better place.
  • Nested container performance and functionality is vastly improved (100X performance in bigger applications!)
  • Xml configuration and the ancient attribute based configuration has been removed.
  • Interception has been completely rewritten with a much better mechanism for applying decorators (a big gripe of mine from 2.5+)
  • Resolving large object graphs is faster
  • The Profile support was completely rewritten and more effective now
  • Child containers (think client specific or feature specific containers)
  • Improvements in the usage of open generics registration for Jimmy Bogard
  • Constructor function selection and lifecycle configuration can be done per Instance (like every other IoC container in the world except for SM < 3.0)
  • Anything that touches ASP.Net HttpContext has been removed to a separate StructureMap.Web nuget.
  • Conventional registration is more powerful now that the configuration model is streamlined and actually useful as a semantic model

Related

118 questions
0
votes
2 answers

How to register and get IUserIdentity from container in NancyFx?

I use FluentValidation with NancyFx. I want to validate some data against current context, exactly against current user. Unfortunately I can't find any example how to register and get back from container (I'm using StructureMap) such a…
dariol
  • 1,959
  • 17
  • 26
0
votes
1 answer

StructureMap: How to inject IUser into constructor

I have an ASP.NET MVC 5 website and I would like to access current user info from my own class (that has no idea of http context). How can I inject it into that class? Apparently, I can't even inject IUser into a MVC controller either. It throws…
Null Head
  • 2,877
  • 13
  • 61
  • 83
0
votes
1 answer

Using a short-lived form objects with StructureMap

I have this application I'm writing and it's become a bit of a disaster in terms of organization due to the size of it. I figured this would be an ideal candidate for implementing IoC using StructureMap v3.1.4.143. I'm setting up my object graph…
0
votes
1 answer

Closing database connection when using StructureMap IoC / Entity Framework?

I am a bit new to StructureMap's IoC (and IoC in general). From examples, I have my stuff set up like this: DefaultRegistry: public DefaultRegistry() { Scan( scan => { scan.TheCallingAssembly(); …
0
votes
1 answer

Trouble Referencing StructureMap.AutoMocking.dll to use RhinoAutoMocker

I've been dying to try out StructureMap's auto mocking container for RhinoMocks per: http://docs.structuremap.net/AutoMocker.htm This documentation states: Out of the box, StructureMap includes the RhinoAutoMocker for RhinoMocks and…
jakejgordon
  • 4,008
  • 7
  • 36
  • 45
0
votes
1 answer

How can I use from Structuremap auto register in asp.net-mvc?

I have a simple mvc application that has 3 layer Ui => has refrence to Common And Services Common Services => has refrence to Common I define my Service Contracts in Common layer and implement it in services layer //Common layer public interface…
M.Azad
  • 3,673
  • 8
  • 47
  • 77
0
votes
1 answer

StructureMap3 How to configure constructor string injection for all types?

I have registered my types using Scan( scan => { scan.TheCallingAssembly(); scan.WithDefaultConventions(); scan.With(new ControllerConvention()); }); But how do I specify for constructor injection with out having to…
David W
  • 483
  • 4
  • 11
0
votes
1 answer

ServiceStack Redis problems with simultaneous read requests

I'm using the ServiceStack.Redis implementation for caching events delivered over a Web API interface. Those events should be inserted into the cache and automatically removed after a while (e.g. 3 days): private readonly…
0
votes
3 answers

Passing an object to constructor when using StructureMap 3

I have some UserControls in my c# project and use Structuremap 3 as my IoC container, when I want to access the UserControls I use following code: var uc = new UserControlFactory().Create(); .... and this is UserControlFactory…
Masoud
  • 8,020
  • 12
  • 62
  • 123
0
votes
2 answers

No default instance or named instance 'Default' for requested plugin type

I'm trying to avoid referencing the concrete type library in my main project, but I'm getting this error: No default instance or named instance 'Default' for requested plugin type StackExchangeChatInterfaces.IClient 1.)…
ton.yeung
  • 4,793
  • 6
  • 41
  • 72
0
votes
4 answers

Setter injection not working with StructureMap in ASP.NET MVC authorization filter

We use a custom AuthorizeAttribute to handle a few aspects of user authorization. I need to add access to the database to check a value during authorization. This project uses the Repository pattern and Repos are all instantiated in controller…
0
votes
1 answer

Why in StructureMap are Singleton classes disposed of and transients aren't

In my application I've noticed that if I mark a class in the SM registry as a Singleton type it gets disposed of, however if don't specify any Singleton it doesn't get disposed of. What and why are the reasons for this? public class IoC { …
user183872
  • 767
  • 2
  • 6
  • 20
0
votes
1 answer

StructureMap: Pass in runtime arguments to a selected constructor

I want to select a constructor and pass in runtime arguments. I know how I can select a constructor with registry provided arguments and I also know how to provide runtime arguments. But I can’t see a way to combine both together. The…
Steve Kinyon
  • 805
  • 1
  • 7
  • 15
0
votes
1 answer

Null User on HttpContext obtained from StructureMap

Ok, my previous question/setup had too many variables, so I'm stripping this down to it's bare bones components. Given the code below using StructureMap3... //IoC setup For().UseSpecial(x => x.ConstructedBy(y => HttpContext.Current…
Nick Albrecht
  • 16,607
  • 10
  • 66
  • 101
0
votes
1 answer

Scanning Assemblys using StructureMap in Asp.net MVC 5

I using StructureMap for dependency resulution. I have 2 projects Project.Web (Website) Project.Web.DependencyResolution (Main Registry is located here and Scanning Starts here.) I am unable to use : Scan( scan => …
Ankesh
  • 4,847
  • 4
  • 38
  • 76