Esempio n. 1
0
 public T Resolve(InstanceGenerator 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>();
     }
 }
Esempio n. 2
0
 public T Resolve(InstanceGenerator instanceGenerator, GenerationTrace trace)
 {
     try
     {
         _nestingLimit.AddNestingFor <T>(trace);
         if (!_nestingLimit.IsReachedFor <T>())
         {
             return(_fakeChain.Resolve(instanceGenerator, trace));
         }
         else
         {
             try
             {
                 trace.NestingLimitReachedTryingDummy();
                 return(instanceGenerator.Dummy <T>(trace)); //TODO
             }
             catch (TargetInvocationException e)
             {
                 return(default(T));
             }
             catch (MemberAccessException e)
             {
                 return(default(T));
             }
             catch (ArgumentException e)
             {
                 return(default(T));
             }
         }
     }
     finally
     {
         _nestingLimit.RemoveNestingFor <T>(trace);
     }
 }
 public object Resolve(InstanceGenerator instanceGenerator, GenerationRequest request, Type type)
 {
     return(request.WithNextNestingLevel(
                () =>
     {
         return _generationChain.Resolve(instanceGenerator, request, type);
     },
                () =>
     {
         try
         {
             request.Trace.NestingLimitReachedTryingDummy();
             return instanceGenerator.Dummy(request, type) !; //TODO
         }
         catch (TargetInvocationException e)
         {
             return default !;
Esempio n. 4
0
 public T GenerateInstance(InstanceGenerator instanceGenerator, GenerationRequest request)
 {
     return(instanceGenerator.Dummy <T>(request));
 }
Esempio n. 5
0
 public T GenerateInstance(InstanceGenerator instanceGenerator)
 {
     return(instanceGenerator.Dummy <T>());
 }
Esempio n. 6
0
 public T GenerateInstance(InstanceGenerator instanceGenerator, GenerationTrace trace)
 {
     return(instanceGenerator.Dummy <T>(trace));
 }