Reputation: 10403
I see a lot of examples of how to use StructureMap in a asp.net project like this:
StructureMapConfiguration.ForRequestedType<IResourceA>()
.TheDefaultIsConcreteType<ResourceB>()
.CacheBy(InstanceScope.Singleton);
Yet, in my Global.asax I can not access the StructureMapConfiguration
object even when I import the StructureMap
namespace. What is the deal here? Am I missing something?
Upvotes: 2
Views: 1428
Reputation: 21
Add in Application_Start()
of Global.asax.cs
file:
ObjectFactory.Initialize(x => x.For<IResourceA>().Use<ResourceB>());
Upvotes: 2
Reputation: 3131
Have you tried the new format:
i.e. in the form:
For<IResourceA>().Use<ResourceB>();
Upvotes: 3