internal void InjectIntoInstance(CycleCounter cycleCounter, object instance) { if (injectedIntoInstances.Add(instance)) { cycleCounter.Indent(); ResolveFields(cycleCounter, instance); ResolveProperties(cycleCounter, instance); ResolveMethods(cycleCounter, instance); cycleCounter.Unindent(); } }
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)); }