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
0 answers

How do I remove AfterMap from Automapper Profiles

I have a profile class where I am using AfterMap() method. My profile class has two constructor dependencies. Problem is that while I am unit testing I am mocking these dependencies but also I require the actual objects when I am doing integration…
Sharthak Ghosh
  • 576
  • 1
  • 9
  • 22
0
votes
1 answer

Passive Attributes and Nested Containers

Final Solution With help from @NightOwl888's answer, here's the final approach I went with for anyone who ends up here: 1) Added the global filter provider: public class GlobalFilterProvider : IFilterProvider { public IEnumerable
ryanulit
  • 4,983
  • 6
  • 42
  • 66
0
votes
0 answers

StructureMap and Project Dependency

Suppose I have the following structure in my C# solution: ServiceProject -- IBusinessLogic.cs -- Service.cs BusinessLogicProject -- IRepository.cs -- BusinessLogic.cs RepositoryProject -- Repository.cs In this case, I have BusinessLogicProject…
Husain
  • 784
  • 1
  • 9
  • 22
0
votes
1 answer

StructureMap and sitecore glassmapper V4

Currently we are using GlassMapper V3 and CastleWindsor in our project. We would like to upgrade it to V4 for performance and use structure map IOC instead of CastleWindsor. Not sure how to make GlassMapper to use structure IOC. Any help on this…
Venkat
  • 853
  • 10
  • 26
0
votes
0 answers

StructureMap3 session-scoped singleton - no session variable?

I'm fairly new to StructureMap. I'm trying to create a session-scoped singleton class (using MVC4 with Sitecore). After some googling i came up with this: x.For().LifecycleIs(new HttpSessionLifecycle()).Use(); Issue is that…
0
votes
1 answer

Structuremap 3 Single Interface Multiple Types

I have a an ASP.NET MVC 5 app, I am using Structuremap 3 as the IOC. I have an Interface which is used in multiple types through the N-Tier and I cannot find a succinct explanation of how to to map multiple types to the same interface for automatic…
Csharper
  • 53
  • 2
  • 10
0
votes
1 answer

StructureMap3 HybridHttpOrThreadLocalScoped with no HttpSessionState

I am trying to figure out how to setup a StructureMap3 configuration, that works in both a WebApi and in a Console application, like: For().HybridHttpOrThreadLocalScoped().Use(p => p.GetInstance().GetSession()); For…
0
votes
1 answer

Is it thread safe to create separate instance of dependent component in case of web api2 using structuremap

I have a web api 2 controller: TestController.cs and an action filter: TestAuthorizeAttribute.cs I am using StructureMap.WebApi2 nuget package for Web API 2 project for setting the dependency injection. I am trying to create instance of TestService…
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
1 answer

Upgrading Shortbus from StructureMap v2 to v3

I've started using Shortbus, but I'm having some DLL versioning issues between the StructureMap.MVC5 package and Shortbus. Shortbus uses StructureMap 2.6.3 and the MVC5 package is using 2.6.3. I've tried dependency redirection, but because of the…
Rebecca
  • 13,914
  • 10
  • 95
  • 136
0
votes
1 answer

MVC5 and OWIN facebook authentication provider not working in IE11 and Firefox (but works in Chrome)

I'm using Asp.Net MVC 5 and utilizing the Microsoft's Identity (v2) implementation for authentication and external (facebook) login. My code for the external login is like this: in Startup.Auth.cs I declare the provider: var…
0
votes
1 answer

Default to Always Unique for unregistered concrete types

Consider this code var container = new Container(); var nested = container.GetNestedContainer(); var f1 = nested.GetInstance(); var f2 = nested.GetInstance(); var result = f1 == f2; //I want result to be false I don't want to register…
Anders
  • 17,306
  • 10
  • 76
  • 144
0
votes
1 answer

How to inject UrlHelper in Web API 2 using StructureMap.WebApi2 nuget package

I am using StructureMap.WebApi2 nuget package for Web API 2 project for managing the depedency injection. The Web API controllers use constructor injection to inject a UrlHelper dependency which should be resolved by StructureMap Ioc. I am trying…
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
0 answers

Injecting Session with StructureMap in ASP .Net MVC

I am trying to inject ASP .Net MVC Session into a Controller by providing in interface for it using StructureMap. But StructureMap complaints while trying to do this as HttpContext.Current is not initialized at the time of registry initialization. I…
0
votes
1 answer

Set a StructureMap Nested Container to resolve unique object instances by default

According to StructureMap's documentation the default behavior of containers is that a Parent Container resolves a new object instance each time one is requested and Nested Containers resolve the same object instance. In 99% of cases this is fine -…
0
votes
1 answer

Getting Reference to StructureMap Container

I'm new to StructureMap and have a scenario where I would like to get a handle to the container. I am building a Web API service initializing StructureMap container in Application_Start of Global.asax IContainer container =…
Jay
  • 177
  • 2
  • 12