public GraphQLModel(IAppEntity app,
                            IEnumerable <ISchemaEntity> schemas,
                            int pageSizeContents,
                            int pageSizeAssets,
                            IUrlGenerator urlGenerator, ISemanticLog log)
        {
            this.log = log;

            partitionResolver = app.PartitionResolver();

            CanGenerateAssetSourceUrl = urlGenerator.CanGenerateAssetSourceUrl;

            assetType     = new AssetGraphType(this);
            assetListType = new ListGraphType(new NonNullGraphType(assetType));

            graphQLTypeVisitor = new GraphQLTypeVisitor(contentTypes, this, assetListType);

            var allSchemas = schemas.Where(x => x.SchemaDef.IsPublished).ToList();

            BuildSchemas(allSchemas);

            graphQLSchema = BuildSchema(this, pageSizeContents, pageSizeAssets, allSchemas);
            graphQLSchema.RegisterValueConverter(JsonConverter.Instance);
            graphQLSchema.RegisterValueConverter(InstantConverter.Instance);

            InitializeContentTypes(allSchemas, pageSizeContents);
        }
Beispiel #2
0
        public GraphQLModel(IAppEntity app, IEnumerable <ISchemaEntity> schemas, GraphQLTypeFactory typeFactory, ISemanticLog log)
        {
            graphQLTypeFactory = typeFactory;

            this.log = log;

            partitionResolver = app.PartitionResolver();

            typeVisitor = new GraphQLTypeVisitor(contentTypes, this);

            var allSchemas = schemas.Where(x => x.SchemaDef.IsPublished).ToList();

            BuildSchemas(allSchemas);

            graphQLSchema = BuildSchema(this, allSchemas);
            graphQLSchema.RegisterValueConverter(JsonConverter.Instance);
            graphQLSchema.RegisterValueConverter(InstantConverter.Instance);

            InitializeContentTypes(allSchemas);

            partitionResolver = null !;

            typeVisitor = null !;
        }