public void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
        {
            if (registration is ConstructorRegistration)
            {
                var constructorRegistration = registration as ConstructorRegistration;

                store.Get<IInjectionOverrideStore>().Add(constructorRegistration.Arguments);
            }
        }
        public void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
        {
            if (registration is ConstructorRegistration)
            {
                var constructorRegistration = registration as ConstructorRegistration;

                store.Get <IInjectionOverrideStore>().Add(constructorRegistration.Arguments);
            }
        }
        public bool IsValid(IActivationRule rule, IInstanceResolver resolver, IServiceLocatorStore context)
        {
            var types = context.Get<IExecutionStore>().RequestedTypes;
            for(int i = 0; i < types.Count; i++)
            {
                var dependency = types[i];
                if (rule.Evaluate(resolver, dependency)) return true;
            }

            return false;
        }
        protected static List<object> MergeContextItems(IServiceLocatorStore context)
        {
            var contextItems = new List<object>();
            var resolutionItems = context.Get<IResolutionStore>().Items;

            for (int i = 0; i < resolutionItems.Count; i++)
            {
                var argument = resolutionItems[i];
                if (argument is ContextArgument) contextItems.Add(((ContextArgument) argument).ContextItem);
            }

            var items = context.Get<IContextStore>().Items;

            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i];
                contextItems.Add(item);
            }

            return contextItems;
        }
Exemple #5
0
        public bool IsValid(IActivationRule rule, IInstanceResolver resolver, IServiceLocatorStore context)
        {
            var types = context.Get <IExecutionStore>().RequestedTypes;

            for (int i = 0; i < types.Count; i++)
            {
                var dependency = types[i];
                if (rule.Evaluate(resolver, dependency))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #6
0
        protected static List <object> MergeContextItems(IServiceLocatorStore context)
        {
            var contextItems    = new List <object>();
            var resolutionItems = context.Get <IResolutionStore>().Items;

            for (int i = 0; i < resolutionItems.Count; i++)
            {
                var argument = resolutionItems[i];
                if (argument is ContextArgument)
                {
                    contextItems.Add(((ContextArgument)argument).ContextItem);
                }
            }

            var items = context.Get <IContextStore>().Items;

            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i];
                contextItems.Add(item);
            }

            return(contextItems);
        }
 public void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
 {
     store.Get<IAwarenessStore>().Add(registration.GetMappedTo());
 }
 public void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
 {
     store.Get <IAwarenessStore>().Add(registration.GetMappedTo());
 }
Exemple #9
0
            public object Resolve(IInstanceResolver locator, IServiceLocatorStore context)
            {
                var store = context.Get <IResolutionStore>();

                return(locator.GetInstance(type, name, store.Items.OfType <IResolutionArgument, IResolutionArgument>()));
            }
Exemple #10
0
        public object GetInstance(Type type, params IResolutionArgument[] arguments)
        {
            store.Get <IResolutionStore>().Add(new List <IResolutionArgument>(arguments));

            return(pipeline.Execute(type));
        }