Questions tagged [structuremap4]

Version 4 of the StructureMap - Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2.

Version 4 of the StructureMap - Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2. It can be found at https://structuremap.github.io/

Related

56 questions
7
votes
1 answer

Asp.Net Core RC1 -> RTM DI changes - Removed FromServices

I'm using structure map with the AspNet Core 1.0 RTM. It appears they have removed using the FromServices attribute on properties. This breaks the code below because I am now unable to inject the ClaimsPrincipal. I'm not sure how to get the DI…
Phil
  • 4,134
  • 4
  • 23
  • 40
5
votes
3 answers

Bi-directional dependency relationship detected

OK I am getting a stack error. The file it is getting caught on is here using System.Web; using NHibernate; using Nichols.Web.App_Start; namespace Nichols.Web.DependencyResolution { public class StructureMapScopeModule : IHttpModule { …
John Edward Law
  • 121
  • 1
  • 9
4
votes
1 answer

StructureMap Not Scanning Assemblies in Current Folder

So I have an issue with the latest StructureMap (v4.6.1) in a ASP.Net Core Web API application: Here is what I have: Web API Project Interface Project Assembly A (Implements subset of interfaces from the Interface Project) Assembly B (Implements…
Toni Kostelac
  • 351
  • 3
  • 17
3
votes
1 answer

StructureMap: The name 'ObjectFactory' does not exist in the current context

I am using StructureMap to resolve dependency, which works fine with older version.But after updating StructureMap version 4.2.0.40, i am facing this error. ObjectFactory is now obsoleted in new version. So how to modify below logic to fit this with…
3
votes
1 answer

StructureMap GetAllInstances returning one instance when several expected

I have an application which modifies records based on commands. I'm using StructureMap as my container and it is not behaving as I would expect. The application has several commands to update some business entities. I have a number of…
Dustin Hodges
  • 4,110
  • 3
  • 26
  • 41
3
votes
3 answers

How to inject a dependency into a custom attribute with StructureMap (4.0)? MVC5 project

I'm pretty much wanting to do what this guy describes (passing a dependency into a custom attribute): How to use dependency injection with an attribute? however, I want to do it with StructureMap 4.0, not Ninject. My project is set up with the…
Kevin
  • 99
  • 1
  • 12
2
votes
1 answer

Error CS0832 An expression tree may not contain an assignment operator

public class ConsoleRegistry : Registry { public ConsoleRegistry() { Scan(scan => { scan.TheCallingAssembly(); scan.WithDefaultConventions(); }); …
senzacionale
  • 20,448
  • 67
  • 204
  • 316
2
votes
1 answer

Using StructureMap[4.7.0] Setter Injection in my MVC5 Controller

I am trying to inject the IApplicationConfigurationSection implementation into this MVC5 Controller, so that I can have access to some of the information (various strings) from my web.config custom section in all of my views: public class…
2
votes
0 answers

How to Resolve an Instance in Structuremap RegistrationConvention

I'm using Structuremap as IOC container. In old version of Structremap I used ObjectFactory, now I have updated to Structremap.Mvc5 from below link: https://github.com/webadvanced/Structuremap.MVC5 But I can't create an instance of…
Saeid Mirzaei
  • 950
  • 2
  • 18
  • 48
2
votes
0 answers

StructureMap: register generic Type as implementation of generic Interface

Given an interface public interface ISomething where TA : class where TB : class, ISomeOtherInterface { object SomeMethod(TSource source, TDestination destination); } And a class implementing it public class Something :…
vzwick
  • 11,008
  • 5
  • 43
  • 63
2
votes
1 answer

StructureMap Pluggable type or namespace could not be found

I am using Visual Studio 2013 in my project (Asp.net 4.5.1). I used NuGet to add StructureMap on my project. The Structure of my Solution is: MyProjectWeb (Created first) MyProjectCore (add second to Solution) MyProjectWebTest (added third to…
K Wagner
  • 21
  • 2
2
votes
1 answer

ASP.Net MVC5 and StructureMap4 - Simplified Approach

While integrating StructureMap.MVC5 to an ASP.Net MVC5 web application, realized that it uses 3.1 version of SM and not 4+. Then tried taking the files included in this Nuget and changing it for SM4, but a lot of code was there and several…
1
vote
2 answers

Can I override a list registration in StructureMap/Autofac?

For overriding/replacing type registrations both frameworks use the "last registration wins". For collections (multiple implementations of the same interface) however, in both frameworks the collection is added to, never completely…
jrunestone
  • 13
  • 3
1
vote
0 answers

Structuremap interception of Controllers

I'd like to use AOP to intercept calls to all methods within ASP.NET Controllers and ApiControllers. Following http://structuremap.github.io/dynamic-interception/ I tried to get it to work as follows. The interceptor at present does nothing much,…
user9314395
  • 407
  • 1
  • 4
  • 13
1
vote
1 answer

StructureMap error - no default instance is registered

I have a console demo app using StructureMap IoC container. The demo has all the interfaces and implementation all in one file in one project and the scanning registry looks like the following: public class ConsoleRegistry : Registry { public…
Rod
  • 14,529
  • 31
  • 118
  • 230
1
2 3 4