Esempio n. 1
0
        object ProvideDefaultConfigurationFor(Type type)
        {
            var providerType = typeof(ICanProvideDefaultConfigurationFor <>).MakeGenericType(type);
            var actualType   = _typeFinder.FindSingle(providerType);
            var instance     = _container.Get(actualType);
            var method       = instance.GetType().GetMethod("Provide", BindingFlags.Public | BindingFlags.Instance);

            return(method.Invoke(instance, null));
        }
        static IContainer DiscoverAndConfigureContainer(
            IContainer bootContainer,
            IAssemblies assemblies,
            ITypeFinder typeFinder,
            IBindingCollection bindingCollection)
        {
            var containerProviderType = typeFinder.FindSingle <ICanProvideContainer>();

            ThrowIfMissingContainerProvider(containerProviderType);

            var containerProvider = bootContainer.Get(containerProviderType) as ICanProvideContainer;

            var container = containerProvider.Provide(assemblies, bindingCollection);

            return(container);
        }
Esempio n. 3
0
 public Type FindSingle <T>()
 {
     return(_typeFinder.FindSingle <T>(_contractToImplementorsMap));
 }