コード例 #1
0
 public LifetimeScopeBeginningMessage(LifetimeScopeModel lifetimeScope)
 {
     if (lifetimeScope == null) throw new ArgumentNullException("lifetimeScope");
     _lifetimeScope = lifetimeScope;
 }
コード例 #2
0
 void AttachToResolveOperation(IResolveOperation resolveOperation, LifetimeScopeModel lifetimeScope)
 {
     
     var resolveOperationModel = _modelMapper.GetResolveOperationModel(resolveOperation, lifetimeScope, new StackTrace());
     Send(new ResolveOperationBeginningMessage(resolveOperationModel));
     resolveOperation.CurrentOperationEnding += (s, e) =>
     {
         var message = e.Exception != null ?
             new ResolveOperationEndingMessage(resolveOperationModel.Id, e.Exception.GetType().AssemblyQualifiedName, e.Exception.Message) :
             new ResolveOperationEndingMessage(resolveOperationModel.Id);
         Send(message);
     };
     resolveOperation.InstanceLookupBeginning += (s, e) => AttachToInstanceLookup(e.InstanceLookup, resolveOperationModel);
 }
コード例 #3
0
ファイル: ModelMapper.cs プロジェクト: mustafatig/whitebox
        public ResolveOperationModel GetResolveOperationModel(IResolveOperation resolveOperation, LifetimeScopeModel lifetimeScope, StackTrace callingStackTrace)
        {
            string locationTypeAssemblyQualifiedName = null, locationMethodName = null;
            var frames = callingStackTrace.GetFrames();
            if (frames != null)
            {
                var lastUserCode = FindResolveCall(frames);
                if (lastUserCode != null)
                {
                    locationMethodName = lastUserCode.Name;
                    locationTypeAssemblyQualifiedName = lastUserCode.DeclaringType.AssemblyQualifiedName;
                }
            }

            return new ResolveOperationModel(NewId(), lifetimeScope.Id, GetThreadId(Thread.CurrentThread), locationTypeAssemblyQualifiedName, locationMethodName);
        }