Questions tagged [structuremap]

StructureMap is a Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2.

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

Installation

StructureMap can most easily be installed through its NuGet package.

Install-Package structuremap

Links

Related

1728 questions
9
votes
3 answers

Is there any better way using hangfire with structuremap on ASP.net core?

I'm using structuremap with hangfire on asp.net core, no error on application but hangfire not process queue/schedule task even though data already on database. Here my snippet configuration public IServiceProvider…
Moch Lutfi
  • 552
  • 10
  • 27
9
votes
4 answers

StructureMap - How to register and resolve an open generic type

public interface IRepository where T : Entity { void Delete(T entity); T[] GetAll(); T GetById(int id); void SaveOrUpdate(T enity); void Merge(T entity); } public interface ITeamEmployeeRepository :…
Rookian
  • 19,841
  • 28
  • 110
  • 180
9
votes
3 answers

Circular dependencies in StructureMap - can they be broken with property injection?

I've got the simplest kind of circular dependency in structuremap - class A relies on class B in its constructor, and class B relies on class A in its constructor. To break the dependency, I made class B take class A as a property, rather than a…
Andy
  • 3,596
  • 8
  • 34
  • 33
9
votes
3 answers

StructureMap Exception after adding the WebApi.HelpPage to a webApi project

I followed the instructions here to add the webApi.HelpPage area and views to an existing project, which uses structureMap - but when accessing the /Help url: StructureMap Exception Code: 202 No Default Instance defined for PluginFamily…
9
votes
2 answers

StructureMap and ASP .Net Web API and .Net Framework 4.5

Does the current version of StructureMap support ASP .Net Web API, MVC 4 and .NET Framework 4.5?
8
votes
2 answers

Entity Framework + POCO

I am building a WPF application using the MVVM pattern. Our stack looks like this: SQL Server 2008 -> Entity Framework We use StructureMap for dependency injection to inject our DataFactory which essentially does the CRUD for our POCO business…
Lukasz
  • 8,710
  • 12
  • 44
  • 72
8
votes
1 answer

Structuremap - multiple interface implementations

I am totally new to Structuremap and am confused on how to wire an interface that has multiple implementations. Lets say I have Controller1 and Controller2. I have Interface1 that is implemented by two separate classes, Class1ForInterface1 and…
Jill
  • 81
  • 1
  • 2
8
votes
2 answers

StructureMap Tutorial

I am look for some Structure map Tutorials. Does anyone know of any? EDIT: All answers are appreciated but I was looking for something that is not on the first 2 pages of Google. I would have the sense to do that first.
Ted Smith
  • 9,415
  • 16
  • 50
  • 52
8
votes
2 answers

Configuring profiles with StructureMap

important; I'm really looking for a StructureMap answer here. Please don't say how to do it with Windsor, Spring, Unity, or any of the others. I'm playing with StructureMap for IoC - and basically my aim is to have a "default" profile that defines…
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
8
votes
1 answer

StructureMap and scanning assemblies

So, I have a .NET solution that uses StructureMap, and I'd like to have StructureMap read an outside assembly that implements an interface from a project in that solution and defines the registry entry for it. StructreMap configuration for my…
Eric C
  • 832
  • 3
  • 8
  • 20
8
votes
2 answers

StructureMap Beginner | Property Injection

Part of this question was already asked here : structuremap Property Injection but the answer was never given. With StructureMap, is it possible to do Property Injection such that class SomeController : Controller { public IService Service { …
Ciel
  • 17,312
  • 21
  • 104
  • 199
8
votes
1 answer

StructureMap register generic types against all possible concrete implementations

I have the following: public interface ICommand { } public class AddUser : ICommand { public string Name { get; set; } public string Password { get; set; } } public interface ICommandHandler : IHandler where T : ICommand { void…
Mikael Östberg
  • 16,982
  • 6
  • 61
  • 79
8
votes
0 answers

Automapper and StructureMap proper instance registration .net Core

At the moment this is the way I wire up IMapper instance of Automapper with StructureMap. public class DefaultRegistry : Registry { public DefaultRegistry() { Scan(o => { o.AddAllTypesOf(); }); …
sensei
  • 7,044
  • 10
  • 57
  • 125
8
votes
1 answer

EF DbContext and StructureMap scoping

Ok, I give up... What I want is to share the EF4's DbContext instance per request. I configured StructureMap like this: For().Use(new MyContext("LocalhostConnString")); But when I refresh my site, or even open it in another browser, I…
Darmak
  • 905
  • 2
  • 11
  • 16
8
votes
3 answers

How do I configure StructureMap to use a generic repository?

I have an interface IGenericRepository where TEntity : IEntity and an implementation GenericRepository where TEntity : Entity. I'm trying to inject a specific IGenericRepository
into a class using StructureMap: …
simonjreid
  • 195
  • 2
  • 7