public static ConstructorInfo GetConstructor(this IResolverConstructorSelector constructorSelector, Type type, IResolver resolver) { ConstructorInfo ctor; if (constructorSelector.TryGetConstructor(type, resolver, out ctor)) { return(ctor); } throw new ResolveException("Unable to resolve type: " + type); }
private Func <object> CreateGetInstanceFunc(Type type) { if (type == typeof(object)) { return(() => new object()); } object instance; if (TryGetInstance(type, out instance)) { return(() => instance); } ConstructorInfo constructor; if (_constructorSelector.TryGetConstructor(type, this, out constructor)) { return(GetCreateInstanceFunc(constructor)); } return(_getInstanceFuncNotFound); }
public static bool CanGetConstructor(this IResolverConstructorSelector constructorSelector, Type type, IResolver resolver) { ConstructorInfo dummy; return(constructorSelector.TryGetConstructor(type, resolver, out dummy)); }