public Task <List <ISchemaEntity> > GetSchemasAsync(DomainId appId) { return(localCache.GetOrCreateAsync($"GetSchemasAsync({appId})", async() => { return await indexSchemas.GetSchemasAsync(appId); })); }
public async Task <List <ISchemaEntity> > GetSchemasAsync(DomainId appId) { var schemas = await localCache.GetOrCreateAsync($"GetSchemasAsync({appId})", () => { return(indexSchemas.GetSchemasAsync(appId)); }); return(schemas); }
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()); }
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); }
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); }