Ejemplo n.º 1
0
        /*
         * Construction & Destroying.
         */

        public void Construct(object instance, bool triggerPostConstructors)
        {
            ValidateInstance(instance, out var type);

            var info = _reflector.Get(type);

            Inject(instance, info);
            if (triggerPostConstructors)
            {
                PostConstruct(instance, info);
            }
        }
Ejemplo n.º 2
0
        /*
         * Private.
         */

        private void ProcessInstanceMethods <T>(object instance) where T : Attribute
        {
            if (instance == null)
            {
                return;
            }

            var info    = _reflector.Get(instance.GetType());
            var methods = info.GetMethodsInfos <T>();

            if (methods.Count == 0)
            {
                return;
            }

            foreach (var method in methods)
            {
                method.Invoke(instance, null);
            }
        }