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
1
vote
1 answer

Masstransit Structuremap per message scope

I am using a repository pattern with Entity Framework where i inject the DbContext in each repository. I have multiple repositories for a single MassTransit consumer. Each repository must share the DbContext in the scope of consuming a single…
pmertz
  • 33
  • 3
1
vote
1 answer

StructureMap thinks it has to inject to constructor and throws exception

I'm using StructureMap and ASP.Net Identity in my application. When I have this line in my Application_Start ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory()); and this is StructureMapControllerFactory: public…
ahmadali shafiee
  • 4,350
  • 12
  • 56
  • 91
1
vote
1 answer

StructureMap and objects not setup for DI/IoC

I have a situation where I've created a factory method to create an object. However, the object has boilerplate code that needs execution before the object is created. Fixing that part of the design is out of scope for this question. Also, when…
Mike
  • 309
  • 2
  • 15
1
vote
1 answer

How can I correctly use StructureMap (or any other IoC container) on a multi layered solution?

I have a 3 layer solution with the following structure: UI -> BLL <- DAL The UI is an ASP.NET MVC application. Each controller requires BLL components on its constructor. And each BLL component requires DAL components on its constructor. In the past…
1
vote
1 answer

Why do Lazy and Func dependencies achieve same in StructureMap

I've noticed that in examples of creating expensive objects, StructureMap can defer creation using the Lazy or Func types for an interface. e.g. Lazy(); I understand that with Lazy the value property is the single point at…
user183872
  • 767
  • 2
  • 6
  • 20
1
vote
2 answers

Dependency Injection and Entities

I have two classes and have one to many relationship as shown below public class User { public string Name{get;set;} public IList
Addresses{get;set} } public class Address { public string StreetAddress{get;set;} public User…
WorkInProgress
  • 393
  • 6
  • 16
1
vote
1 answer

Mystery with dynamic type & double dispatch

Recently I came across an interesting problem trying to implement double dispatch via dynamic type. A little background: in one of my projects I use StructureMap container and dynamic type as a clean way to dispatch method calls at runtime. After…
alekseevi15
  • 1,732
  • 2
  • 16
  • 20
1
vote
1 answer

WCF with StructureMap: Operation could destabilize the runtime

I encountered this weird error when I used WCF with StructureMap. I also tried to search the stack and there are some answers that recommend to install a hotfix: Operation could destabilize the runtime in StructureMap But I cannot install the hotfix…
Vu Nguyen
  • 3,605
  • 3
  • 22
  • 34
1
vote
1 answer

Inject SignalR v2.0 Hubs in Controller/Assembly

I want to Call my Client methods from the controller/ServiceAssembly Currently I am using //Notify Others of the Login GlobalHost.ConnectionManager.GetHubContext().Clients.All.NotifyOthersAllOnLogin(string.Format("Recent…
Ankesh
  • 4,847
  • 4
  • 38
  • 76
1
vote
0 answers

WinForms and StructureMap default life cycle

Please consider the following codes private static void InitializeStructureMap() { ObjectFactory.Initialize(x => { x.For().Use(); …
ramin_rp
  • 321
  • 1
  • 4
  • 14
1
vote
2 answers

StructureMap Convention - Differences between Registy.AddType and Registry.For().Use()

Short question. Exists some diference between registry.AddType(pluginType, type); and registry.For(pluginType).Use(type); ? Code: public class BasicConvention : ConfigurableRegistrationConvention { public override void Process(Type type,…
Javier Ros
  • 3,511
  • 2
  • 21
  • 41
1
vote
0 answers

VerificationException configuring StructureMap 3 Registry

After updating our working application from StructureMap 2.6.4.1 to StructureMap 3.0.5.130 on an unpatched Windows 2012 Data Center OS, we get the following exception configuring the StructureMap registry from a ASP.NET MVC 4.0 app on .NET…
flipdoubt
  • 13,897
  • 15
  • 64
  • 96
1
vote
1 answer

Register singleton that implements two interfaces

What is the correct way to configure an object in structuremap that implements two interface but is a singleton. For example class Main implements both iMainFrmService and iActiveJobService. Here is what I've tried, but I'm not sure if it's…
Reactgular
  • 52,335
  • 19
  • 158
  • 208
1
vote
1 answer

StructureMap 3 break change

The following code not working on StructureMap 3: x.For() .LifecycleIs(StructureMap.Pipeline.Lifecycles.GetLifecycle(InstanceScope.HttpContext)) .Use(c => Environment.GetEnvironment("APP")); x.SelectConstructor(() => new…
Tony Bao
  • 922
  • 2
  • 12
  • 23
1
vote
1 answer

StructureMap 3 Breaking Change

In previous versions of StructureMap, I have a code like this: _container.Configure(config => config .For.Use.Ctor("loggerName") .Is((IContext ctx) => ctx.Root.RequestedType.ToString)) Using this, I…
Afshin Gh
  • 7,918
  • 2
  • 26
  • 43