title: Creating a fallback container/resolver DryIoc
body: <p>Current working on creating a Prism.DryIoc.Forms project to try out DryIoc (first time!).</p>
  
  <p>In Xamarin.Forms there is a native DependencyService and to provide a nice way to migrate towards using Prism I would like to add it as a fallback container in case the requsted service type can't be resolved from the main container.</p>
  
  <p>Current I have created a <code>FallbackContainer</code> and pass the instance of <code>IContainer</code>and overrides the methods for <code>IResolver</code> and delegates the rest of the <code>IContainer</code> calls to the instance passed during creation.</p>
  
  <p>So after the default container is created and configured and then do</p>
  
  <pre><code>Container = CreateContainer();
  ConfigureContainer();
  Container.Rules.WithFallbackContainer(new DependencyServiceContainer(Container));
  </code></pre>
  
  <p>Is this the preferred method or is there any way just to attach a default <code>IResolver</code>?</p>
  
  <p>Current implementation</p>
  
  <pre><code>public class FallbackDependencyServiceContainer : IContainer
      {
          private readonly IContainer container;
  
          public FallbackDependencyServiceContainer(IContainer container)
          {
              this.container = container;
          }
  
          public object Resolve(Type serviceType, bool ifUnresolvedReturnDefault)
          {
              return ResolveFromDependencyService(serviceType);
          }
  
          public object Resolve(Type serviceType, object serviceKey, bool ifUnresolvedReturnDefault,
              Type requiredServiceType,
              RequestInfo preResolveParent, IScope scope)
          {
              return ResolveFromDependencyService(serviceType);
          }
  
          public IEnumerable&lt;object&gt; ResolveMany(Type serviceType, object serviceKey, Type requiredServiceType,
              object compositeParentKey,
              Type compositeParentRequiredType, RequestInfo preResolveParent, IScope scope)
          {
              return new[] { ResolveFromDependencyService(serviceType) };
          }
  
          private static object ResolveFromDependencyService(Type targetType)
          {
              if (!targetType.GetTypeInfo().IsInterface)
              {
                  return null;
              }
              var method = typeof(DependencyService).GetTypeInfo().GetDeclaredMethod("Get");
              var genericMethod = method.MakeGenericMethod(targetType);
              return genericMethod.Invoke(null, new object[] { DependencyFetchTarget.GlobalInstance });
          }
  ....
  }
  </code></pre>
  
  <p>Thanks and looking forward to test DryIoc since I've read it's supposed to be the fastest out there</p>