示例#1
0
        public void Should_build_dynamic_content_query_model()
        {
            var languagesConfig = LanguagesConfig.English.Set(Language.DE);

            var queryModel = ContentQueryModel.Build(null, languagesConfig.ToResolver(), ResolvedComponents.Empty);

            Assert.NotNull(queryModel);
        }
示例#2
0
        public async Task <IActionResult> GetFilters(string app, string schema)
        {
            var components = await appProvider.GetComponentsAsync(Schema, HttpContext.RequestAborted);

            var filters = ContentQueryModel.Build(Schema.SchemaDef, App.PartitionResolver(), components).Flatten();

            return(Ok(filters));
        }
示例#3
0
        public void Should_build_content_query_model()
        {
            var languagesConfig = LanguagesConfig.English.Set(Language.DE);

            var(schema, components) = TestUtils.MixedSchema();

            var queryModel = ContentQueryModel.Build(schema, languagesConfig.ToResolver(), components);

            CheckFields(queryModel.Schema, schema);
        }
示例#4
0
        private QueryModel BuildQueryModel(Context context, ISchemaEntity?schema,
                                           ResolvedComponents components)
        {
            var cacheKey = BuildJsonCacheKey(context.App, schema, context.IsFrontendClient);

            var result = cache.GetOrCreate(cacheKey, entry =>
            {
                entry.AbsoluteExpirationRelativeToNow = CacheTime;

                return(ContentQueryModel.Build(schema?.SchemaDef, context.App.PartitionResolver(), components));
            });

            return(result);
        }