示例#1
0
 public Task <List <ISchemaEntity> > GetSchemasAsync(DomainId appId)
 {
     return(localCache.GetOrCreateAsync($"GetSchemasAsync({appId})", async() =>
     {
         return await indexSchemas.GetSchemasAsync(appId);
     }));
 }
示例#2
0
        public async Task <List <ISchemaEntity> > GetSchemasAsync(DomainId appId)
        {
            var schemas = await localCache.GetOrCreateAsync($"GetSchemasAsync({appId})", () =>
            {
                return(indexSchemas.GetSchemasAsync(appId));
            });

            return(schemas);
        }
示例#3
0
        public async Task Should_get_schemas_from_index()
        {
            var schema = Mocks.Schema(app.NamedId(), schemaId);

            A.CallTo(() => indexForSchemas.GetSchemasAsync(app.Id, ct))
            .Returns(new List <ISchemaEntity> {
                schema
            });

            var result = await sut.GetSchemasAsync(app.Id, ct);

            Assert.Equal(schema, result.Single());
        }
示例#4
0
        public async Task <List <ISchemaEntity> > GetSchemasAsync(DomainId appId,
                                                                  CancellationToken ct = default)
        {
            var schemas = await localCache.GetOrCreateAsync($"GetSchemasAsync({appId})", () =>
            {
                return(indexForSchemas.GetSchemasAsync(appId, ct));
            });

            foreach (var schema in schemas)
            {
                localCache.Add(SchemaCacheKey(appId, schema.Id), schema);
                localCache.Add(SchemaCacheKey(appId, schema.SchemaDef.Name), schema);
            }

            return(schemas);
        }
示例#5
0
        public async Task <List <ISchemaEntity> > GetSchemasAsync(DomainId appId)
        {
            var schemas = await localCache.GetOrCreateAsync($"GetSchemasAsync({appId})", () =>
            {
                return(indexSchemas.GetSchemasAsync(appId));
            });

            foreach (var schema in schemas)
            {
                localCache.Add(SchemaCacheKey(appId, schema.Id), schema);
                localCache.Add(SchemaCacheKey(appId, schema.SchemaDef.Name), schema);
            }

            foreach (var schema in schemas)
            {
                await ResolveSchemaAsync(appId, schema.SchemaDef);
            }

            return(schemas);
        }