public override object Resolve(CreationContext context, IReleasePolicy releasePolicy) { var currentScope = MsLifetimeScope.Current; if (currentScope == null) { //Act as transient! var burden = CreateInstance(context, false); if (!releasePolicy.HasTrack(burden.Instance)) { Track(burden, releasePolicy); } return(burden.Instance); } lock (currentScope) { return(base.Resolve(context, releasePolicy)); } }
public void Doesnt_track_simple_components_transient() { container.Register(Transient <A>()); var a = container.Resolve <A>(); Assert.IsFalse(releasePolicy.HasTrack(a)); }