예제 #1
0
        internal void InjectIntoInstance(CycleCounter cycleCounter, object instance)
        {
            if (injectedIntoInstances.Add(instance))
            {
                cycleCounter.Indent();

                ResolveFields(cycleCounter, instance);
                ResolveProperties(cycleCounter, instance);
                ResolveMethods(cycleCounter, instance);

                cycleCounter.Unindent();
            }
        }
예제 #2
0
        private InstanceWrapper CreateInstance(CycleCounter cycleCounter, Type type, object[] args)
        {
            cycleCounter.Indent();

            var suitableConstructor = GetConstructor(type);
            var resolvedArgs        = ResolveArgs(cycleCounter, suitableConstructor, args);
            var instance            = activator.CreateInstance(suitableConstructor, resolvedArgs);

            cycleCounter.Unindent();

            InjectIntoInstance(cycleCounter, instance);

            return(new InstanceWrapper(instance));
        }