public Burden CreateBurden(IComponentActivator componentActivator, bool trackedExternally) { ResolutionContext resolutionContext; try { resolutionContext = resolutionStack.Peek(); } catch (InvalidOperationException) { throw new ComponentActivatorException( "Not in a resolution context. 'CreateBurden' method can only be called withing a resoltion scope. (after 'EnterResolutionContext' was called within a handler)", null); } var activator = componentActivator as IDependencyAwareActivator; if (activator != null) { trackedExternally |= activator.IsManagedExternally(resolutionContext.Handler.ComponentModel); } return resolutionContext.CreateBurden(trackedExternally); }
protected virtual Burden CreateInstance(CreationContext context, bool trackedExternally) { var burden = context.CreateBurden(ComponentActivator, trackedExternally); var instance = componentActivator.Create(context, burden); Debug.Assert(ReferenceEquals(instance, burden.Instance)); return burden; }