Пример #1
0
        private void RegisterInterfaceTypes(Type intrfce, string interfaceName)
        {
            // Get all the types that implement the interface
            var types = _assemblyResolver.GetAssemblies().SelectMany(assembly => assembly.GetTypes()
                                                                     .Where(type => intrfce.IsAssignableFrom(type)));

            // Add all the types that implement the interface to the pool
            foreach (var type in types)
            {
                List <IGraphType> implementors;

                if (!InterfaceImplementations.TryGetValue(interfaceName, out implementors))
                {
                    implementors = new List <IGraphType>();
                    InterfaceImplementations.Add(interfaceName, implementors);
                }

                implementors.Add(GetGraphType(type));
            }
        }
 public static IEnumerable <Type> GetMutationTypes(this IAssemblyResolver assemblyResolver, Type rootType)
 => assemblyResolver.GetAssemblies()
 .SelectMany(x => x.GetTypes())
 .Where(x => typeof(IGraphNodeType).IsAssignableFrom(x))
 .Where(x => x.GetAttribute <MutationAttribute>() != null)
 .Where(x => x.GetAttribute <MutationAttribute>().Root == rootType);