Fixed issue with StructureMapDependencyResolver to allow it to work out with ASP.NET. #23

Merged
merged 1 commit into from Sep 12, 2011

2 participants

@liddellj

Replaced instances of InstanceScope.HttpContext with InstanceScope.Hybrid to allow StructureMapDependencyResolver to be used out with ASP.NET.

Previously, StructureMapDependencyResolver would internally translate DependencyLifetime.PerRequest to InstanceScope.HttpContext. This is fine within an ASP.NET host, but causes an issue when using a host which does not have access to HttpContext.

To solve this, I modified StructureMapDependencyResolver, replacing instances of InstanceScope.HttpContext with InstanceScope.Hybrid, which from the StructureMap documentation:
"Uses HttpContext storage if it exists, otherwise uses ThreadLocal storage"

@liddellj liddellj Replaced instances of InstanceScope.HttpContext with InstanceScope.Hy…
…brid to allow StructureMapDependencyResolver to be used out with ASP.NET.
1d9f834
@serialseb serialseb merged commit 7a9ca68 into openrasta:master Sep 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment