private void RegisterInterfacesAndUnions(IServiceLocator serviceLocator) { var interfaces = GraphTypeLoader.GetGraphInterfaces(serviceLocator).ToArray(); var unions = GraphTypeLoader.GetGraphUnions(serviceLocator).ToArray(); RegisterTypes(interfaces); RegisterTypes(unions); }
private void RegisterCustomGraphTypes(IServiceLocator serviceLocator) { var customGraphTypes = GraphTypeLoader.GetCustomGraphTypes(serviceLocator).ToArray(); foreach (var customGraphType in customGraphTypes) { GraphTypeTypeRegistry.Register(customGraphType.TargetType, customGraphType.GetType()); } }
public ContentReferenceGraphType(IContentLoader contentLoader, IServiceLocator serviceLocator) { Name = "ContentReference"; // Get IContent graph interface type var contentInterface = GraphTypeLoader.GetGraphInterface <IContent>(serviceLocator); Field("Id", x => x.ID); Field(contentInterface.GetType(), "Content", resolve: x => { var content = contentLoader.Get <IContent>(x.Source); return(GraphTypeFilter.ShouldFilter(content) ? null : content); }); }
public ContentAreaGraphType(IServiceLocator serviceLocator) { Name = "ContentArea"; // Create ListGraphType<> with IContent graph interface type var contentInterface = GraphTypeLoader.GetGraphInterface <IContent>(serviceLocator); var itemsType = typeof(ListGraphType <>).MakeGenericType(contentInterface.GetType()); Field(x => x.Count); Field(itemsType, "FilteredItems", resolve: context => context .Source .FilteredItems .Select(item => item.GetContent() ) .FilterHiddenGraphTypes() ); }