Bosphorus.Library.Dao.Facade.Facade.Loader.FromAssemblyDescriptor.IsAppropriateDelegate C# (CSharp) Method

IsAppropriateDelegate() private method

private IsAppropriateDelegate ( Type repositoryServiceType, string inNamespace, string endsWith ) : Predicate
repositoryServiceType System.Type
inNamespace string
endsWith string
return Predicate
        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;
            };
        }