public IService Find(IServiceList list, Type typeKey) { if (GenericParametersChecker.Check(typeKey)) { return(GenericServiceFinder .FindGenericServices(list, typeKey) .FirstOrDefault()); } bool isClass = TypeIsClassValidator.Validate(typeKey); return(isClass ? ByClassFinder.FindByClass(list, typeKey) : ByInterfaceFinder.FindByInterface(list, typeKey)); }
public IServiceGenericRegistration Generate(Type type) { ServiceGenericRegistrationBuilder builder = new ServiceGenericRegistrationBuilder(); return(builder .HasGenericParameters(TypeContainsGenericParametersChecker.Check(type)) .SetGenericParameters(ParametersProvider.ProvideGenericTypes(type)).Build()); }
public IInterface GenerateInterface(Type type) { IInterface @interface = new InterfaceBuilder() .AddType(type) .AddGenericParameters(GenericParametersProvider.ProvideGenericTypes(type)) .HasGenericArguments(TypeContainsGenericParametersChecker.Check(type)) .Build(); return(@interface); }
public bool Check(Type type) { if (ContainsGenericParametersChecker.Check(type)) { Type enumerable = GenericGenerator.Generate(typeof(IEnumerable <>), GenericParametersProvider.ProvideGenericTypes(type).FirstOrDefault()); return(enumerable.IsAssignableFrom(type)); } return(false); }