예제 #1
0
 public T Resolve(IInstanceGenerator instanceGenerator)
 {
     try
     {
         _perTypeNestingLimit.AddNestingFor <T>();
         if (!_perTypeNestingLimit.IsReachedFor <T>())
         {
             return(_fakeChain.Resolve(instanceGenerator));
         }
         else
         {
             try
             {
                 return(instanceGenerator.Dummy <T>());
             }
             catch (TargetInvocationException e)
             {
                 return(default(T));
             }
             catch (MemberAccessException e)
             {
                 return(default(T));
             }
             catch (ArgumentException e)
             {
                 return(default(T));
             }
         }
     }
     finally
     {
         _perTypeNestingLimit.RemoveNestingFor <T>();
     }
 }