protected override object DoGetInstance(Type serviceType, string key) { if (string.IsNullOrEmpty(key)) { return(Container.GetInstance(serviceType)); } return(Container.GetInstance(serviceType, key)); }
public static void SetProperties <T>(this ITypeContext context, T typeToSetProperties) where T : class { foreach (var property in typeToSetProperties.GetType().GetProperties()) { var instance = context.GetInstance(property.PropertyType); if (instance != null) { typeToSetProperties.GetType().GetProperty(property.Name).SetValue(typeToSetProperties, instance); } } }