ActionControllers.ControllerActionLocator.Build C# (CSharp) Метод

Build() публичный Метод

public Build ( ) : Type>.Dictionary
Результат Type>.Dictionary
        public Dictionary<string, Type> Build()
        {
            var actionTypes = (from type in types
                               where type.IsPublic
                               where type != typeof (ActionController)
                               where typeof (ActionController).IsAssignableFrom(type)
                               where !type.IsAbstract
                               where !type.IsInterface
                               select type);

            var located = actionTypes
                .Where(x => predicates.All(func => func(x)))
                .Select(x => new { Type = x, Name = namingConventions.BuildKeyFromType(x)}).ToDictionary(x => x.Name, x => x.Type);

            return located;
        }

Usage Example

Пример #1
0
        public Dictionary <string, Type> Build()
        {
            var locator = new ControllerActionLocator(NamingConventions);

            if (FindAssemblyFromType != null)
            {
                locator = locator.FindActionsFromAssemblyContaining(FindAssemblyFromType);
            }

            if (CurrentAssembly)
            {
                locator = locator.FindActionsFromAssembly(FindTheCallingAssembly());
            }

            foreach (var predicate in Predicates)
            {
                locator.Where(predicate);
            }

            return(locator.Build());
        }