/* * 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); } }
/* * 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); } }