private Predicate<Type> IsAppropriateDelegate(Type repositoryServiceType, string inNamespace, string endsWith)
{
return delegate(Type type)
{
string typeName = GetTypeName(type);
if ((endsWith != null) && (!typeName.EndsWith(endsWith, StringComparison.InvariantCultureIgnoreCase)))
return false;
if ((inNamespace != null) && (!type.Namespace.StartsWith(inNamespace, StringComparison.InvariantCultureIgnoreCase)))
return false;
if (type.IsAbstract)
return false;
if (type.IsGenericType)
return false;
Type[] interfaces = type.GetInterfaces();
foreach (Type @interface in interfaces)
{
if ([email protected])
continue;
if (@interface.GetGenericTypeDefinition().Equals(repositoryServiceType))
return true;
}
return false;
};
}