public virtual Object Incarnate() { try { ComponentInstanceBurden burden = new ComponentInstanceBurden(); object[] arguments = BuildArguments(burden); Object instance = Activator.CreateInstance(m_componentModel.ConstructionModel.Implementation, arguments); SetupProperties(instance, burden); AssociateBurden(instance, burden); instance = RaiseWrapEvent(instance); RaiseComponentReadyEvent(instance); return instance; } catch(Exception ex) { throw new HandlerException("Exception while attempting to instantiate type", ex); } }
protected virtual object[] BuildArguments(ComponentInstanceBurden burden) { return Assembler.BuildConstructorArguments( m_componentModel, burden, new ResolveTypeHandler(ResolveType)); }
private void AssociateBurden(object instance, ComponentInstanceBurden burden) { if (burden.HasBurden) { m_instance2Burden.Add(instance, burden); } }
protected virtual void SetupProperties(object instance, ComponentInstanceBurden burden) { Assembler.AssembleProperties( instance, m_componentModel, burden, new ResolveTypeHandler(ResolveType)); }