Exemplo n.º 1
0
        protected override IGraphType GetGraphType(GraphTypeCache cache, IServiceCollection services)
        {
            if (_scalarTypeMap.TryGetGraphType(typeof(TElem), out var scalarGraphType))
            {
                var listType = typeof(ListGraphType <>).MakeGenericType(scalarGraphType);

                return((IGraphType)Activator.CreateInstance(listType));
            }

            return(new ListGraphType(cache.GetOrCreate <TElem>(services)));
        }
Exemplo n.º 2
0
        protected override IGraphType GetGraphType(GraphTypeCache cache, IServiceCollection services)
        {
            if (_scalarTypeMap.TryGetGraphType(typeof(TProp), out var scalarGraphType))
            {
                var listGraphType    = typeof(ListGraphType <>).MakeGenericType(scalarGraphType);
                var listTypeInstance = (ListGraphType)Activator.CreateInstance(listGraphType);
                listTypeInstance.ResolvedType = (IGraphType)Activator.CreateInstance(scalarGraphType);
                if (listTypeInstance.ResolvedType is NonNullGraphType elemTypeInstance)
                {
                    elemTypeInstance.ResolvedType = (IGraphType)Activator.CreateInstance(scalarGraphType.GetGenericArguments().Single());
                }

                return(listTypeInstance);
            }

            return(new ListGraphType(cache.GetOrCreate(typeof(TProp), services)));
        }
Exemplo n.º 3
0
 protected override IGraphType GetGraphType(GraphTypeCache cache, IServiceCollection services)
 {
     return(cache.GetOrCreate <TProp>(services));
 }
Exemplo n.º 4
0
 protected override IGraphType GetGraphType(GraphTypeCache cache, IServiceCollection services)
 {
     return(new ListGraphType(cache.GetOrCreate <TElem>(services)));
 }
Exemplo n.º 5
0
 protected override IGraphType GetGraphType(GraphTypeCache cache, IServiceCollection services)
 {
     return(cache.GetOrCreate <Connection <TModel> >(services));
 }