示例#1
0
 private object FallbackResolve(Type type)
 {
     return(_dependencyFactory.FallbackBehavior switch
     {
         FallbackResolveBehavior.ThrowException => throw new InvalidOperationException($"No suitable registration has been found to resolve type {type}.{Environment.NewLine}Available registrations:{Environment.NewLine}{Environment.NewLine}{DumpSlots(this)}"),
         _ => EnlistDisposable(DependencyDescriptor.FindConstructor(type).Invoke(this))
     });
示例#2
0
 public void RegisterType <T>(InstanceScope scope, Action <RegistrationOptions> options = null)
 {
     Register(typeof(T), DependencyDescriptor.FindConstructor(typeof(T)), options, scope, false);
 }