private ILifetimeScope GetScope(CreationContext context)
{
var localScope = accessor;
if (localScope == null)
{
throw new ObjectDisposedException("Scope was already disposed. This is most likely a bug in the calling code.");
}
var scope = localScope.GetScope(context);
if(scope == null)
{
throw new ComponentResolutionException(
string.Format(
"Could not obtain scope for component {0}. This is most likely either a bug in custom {1} or you're trying to access scoped component outside of the scope (like a per-web-request component outside of web request etc)",
Model.Name,
typeof(IScopeAccessor).ToCSharpString()),
Model);
}
return scope;
}
}