adamfinstorp
adamfinstorp

Reputation: 1677

StructureMap in ASP.NET Web API 2 without a reference to System.Web.Mvc

The StructureMap.WebApi2 package has a dependency to StructureMap.MVC5 which in return has a dependency to System.Web.Mvc.

As we are building a Web API-only project we don't want to include the System.Web.Mvc assembly.

Is it possible to use StructureMap in Web API 2 without this dependency?

Upvotes: 2

Views: 830

Answers (2)

Omar.Alani
Omar.Alani

Reputation: 4130

Autofac is a good Ioc for Web Api, and Autofac is far better in documentation than structuremap, most of the structuremap examples are old and useless for version 3 for example.

  • Here, you can find a quick start for using Autofac.
  • Here, you can find a good start-up for using Autofac with OWIN.

Hope that helps.

Upvotes: 0

Mihai Dinculescu
Mihai Dinculescu

Reputation: 20033

Sadly no.

StructureMap is made for MVC so it obviously depends on it.

Why do you insist on using StructureMap though? All it does is DI and there are many other options to do DI in Web API, like Ninject and Unity.

Upvotes: 1

Related Questions