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

What is the equivalent of HybridHttpOrThreadLocalScoped in structure map 3?

With structuremap 2.6.4.1 my container is configured like this: existingContainer.Configure(expression => { expression.For() .HybridHttpOrThreadLocalScoped() .Use(container => { …
marcus
  • 9,616
  • 9
  • 58
  • 108
15
votes
1 answer

Structuremap interception for registry scanned types

I have a ASP MVC 4 app that uses Structuremap. I'm trying to add logging to my application via Structuremap interception. In a Registry, I scan a specific assembly in order to register all of it's types with the default convention: public class…
rinat
  • 167
  • 1
  • 1
  • 7
7
votes
0 answers

How To Override StructureMap 3 Plugin Mapping

We are using StructureMap 3.1.6.186 and are running into a problem with overriding a particular plugin. In our case, we have a console application which we are deploying to a remote server. The Console application has a very distant dependency on an…
jakejgordon
  • 4,008
  • 7
  • 36
  • 45
7
votes
1 answer

StructureMap causes Stack Empty exception in Web API Help Pages ModelDescriptionLink.cshtml

I have a Web API project which uses StructureMap for its DI. It's been working fine for awhile, but I'm having some issues with the Web API help pages (Microsoft.AspNet.WebApi.HelpPage) where InvalidOperationExceptions are being thrown as a result…
Zout
  • 821
  • 10
  • 18
7
votes
1 answer

StructureMap throws ArgumentNullException on HttpContext

I'm having a very weird issue with StructureMap.MVC5 I created a brand new MVC5 project in Visual Studio (default options for an ASP.net MVC project were left selected.) I then installed structuremap.mvc5 via the nuget package manager…
Sk93
  • 3,676
  • 3
  • 37
  • 67
7
votes
2 answers

Structure Map parameterless constructor error

I am trying to set up structure map ver 3.0.5.0 with Web API 2. I have followed this implementation: Configuring dependency injection with ASP.NET Web API 2.1 However, I am getting this error when doing a get against my ComplexesController: An…
Greg
  • 2,654
  • 3
  • 36
  • 59
6
votes
1 answer

How to set StructureMap 3 Lifecycle

In StructureMap 2 I had something like this: For().HybridHttpOrThreadLocalScoped().Use(); When using Structure Map 3 should I use the following? For().LifecycleIs().Use(); Then I tried to apply…
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
6
votes
1 answer

Dependency injection of the current User in an MVC application using StructureMap3

I have an existing application using the last build from the 2.x version of Structuremap, and it works fine. StructureMap 3 just went live recently and I decided to try updating to it and see how it goes. However no matter what I do, I can't seem to…
Nick Albrecht
  • 16,607
  • 10
  • 66
  • 101
5
votes
2 answers

Accessing HttpContext.Current.User.Identity.Name in the DbContext

I'm going to use the UserName for tracking Created and Modified fields. To do that I have referenced to the System.Web assembly directly inside DbContext: public void auditFields() { var auditDate = DateTime.Now; foreach…
Sirwan Afifi
  • 10,654
  • 14
  • 63
  • 110
5
votes
1 answer

Decoration using Castle DynamicProxy and StructureMap 3 in a Convention - DecorateAllWith

How to use DecorateAllWith to decorate with a DynamicProxy all instances implements an interface? For example: public class ApplicationServiceInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { // ... …
Javier Ros
  • 3,511
  • 2
  • 21
  • 41
5
votes
3 answers

"Operation could destabilize the runtime" when using ANTS profiler on a StructureMap application

We are recently upgraded a web/mvc application to use StrucutreMap 3.0.4 Now, when attempting to profile the application using RedGate Ant's profiler at the "Line Level Timings, All Methods with Source" or greater level, we get the following…
Dave
  • 1,068
  • 12
  • 26
5
votes
1 answer

Structuremap 3.0 EqualToAppSetting

I have upgraded to SM 3.0 and now, amongst other breaking changes I find that EqualToAppSetting is gone. I used to be able to do .Use().Ctor("connectionStr").EqualToAppSetting("myAppSetting"); where of course myAppSetting is…
Raif
  • 8,641
  • 13
  • 45
  • 56
5
votes
1 answer

What is the equivalent of ObjectFactory.Inject in StructureMap 3.0

I recently upgraded to StructureMap 3.0 and noticed that ObjectFactory.Inject is missing. What is the equivalent for simple injection config that this method provided?
leojh
  • 7,160
  • 5
  • 28
  • 31
5
votes
1 answer

How to make setter injection in structuremap 3

I've been updated to structuremap 3, and now I can't use FillAllPropertiesOfType for setter injection. Is it deprecated, what should I use instead?
Bohdan
  • 1,984
  • 3
  • 20
  • 27
4
votes
1 answer

StructureMap constructor arguments are applied to properties

I am registering a class with StructureMap that includes a TimeSpan in the constructor parameters and another TimeSpan as a property of the class. When I use a named constructor argument in StructureMap the value for the constructor argument is…
Navcomp
  • 61
  • 4
1
2 3 4 5 6 7 8