コード例 #1
0
        void AttachToLifetimeScope(ILifetimeScope lifetimeScope, ILifetimeScope parent = null)
        {
            var lifetimeScopeModel = _modelMapper.GetLifetimeScopeModel(lifetimeScope, parent);
            var message = new LifetimeScopeBeginningMessage(lifetimeScopeModel);
            Send(message);

            lifetimeScope.CurrentScopeEnding += (s, e) =>
            {
                Send(new LifetimeScopeEndingMessage(lifetimeScopeModel.Id));
                _modelMapper.IdTracker.ForgetId(lifetimeScope);
            };

            lifetimeScope.ChildLifetimeScopeBeginning += (s, e) => AttachToLifetimeScope(e.LifetimeScope, lifetimeScope);
            lifetimeScope.ResolveOperationBeginning += (s, e) => AttachToResolveOperation(e.ResolveOperation, lifetimeScopeModel);
        }
コード例 #2
0
 public void SetUp()
 {
     _fixture = new ModuleTestHarness();
     _profilerConnectedMessage = _fixture.GetSingleMessageOrDefault<ProfilerConnectedMessage>();
     _rootScopeBeginningMessage = _fixture.GetSingleMessageOrDefault<LifetimeScopeBeginningMessage>();
 }
コード例 #3
0
 public void SetUp()
 {
     _fixture = new ModuleTestHarness();
     _fixture.ClearMessages();
     _lifetimeScope = _fixture.Container.BeginLifetimeScope();
     _lifetimeScope.Dispose();
     _lifetimeScopeBeginningMessage = _fixture.GetSingleMessageOrDefault<LifetimeScopeBeginningMessage>();
     _lifetimeScopeEndingMessage = _fixture.GetSingleMessageOrDefault<LifetimeScopeEndingMessage>();
 }