public virtual async Task <IAssetEntity> FindAssetAsync(Guid id) { var asset = cachedAssets.GetOrDefault(id); if (asset == null) { asset = await assetQuery.FindAssetAsync(context, id); if (asset != null) { cachedAssets[asset.Id] = asset; } } return(asset); }
public async Task <IActionResult> GetAsset(string app, Guid id) { var asset = await assetQuery.FindAssetAsync(Context, id); if (asset == null) { return(NotFound()); } var response = Deferred.Response(() => { return(AssetDto.FromAsset(asset, this, app)); }); return(Ok(response)); }
public async Task <IActionResult> GetAsset(string app, Guid id) { var context = Context(); var entity = await assetQuery.FindAssetAsync(context, id); if (entity == null) { return(NotFound()); } var response = AssetDto.FromAsset(entity); Response.Headers["ETag"] = entity.Version.ToString(); Response.Headers["Surrogate-Key"] = entity.Id.ToString(); return(Ok(response)); }
public async Task <IActionResult> GetAsset(string app, Guid id) { var asset = await assetQuery.FindAssetAsync(id); if (asset == null) { return(NotFound()); } var response = AssetDto.FromAsset(asset, this, app); if (controllerOptions.Value.EnableSurrogateKeys) { Response.Headers["Surrogate-Key"] = asset.Id.ToString(); } Response.Headers[HeaderNames.ETag] = asset.Version.ToString(); return(Ok(response)); }
public async Task <IActionResult> GetAsset(string app, Guid id) { var asset = await assetQuery.FindAssetAsync(Context, id); if (asset == null) { return(NotFound()); } var response = Deferred.Response(() => { return(AssetDto.FromAsset(asset, this, app)); }); if (controllerOptions.EnableSurrogateKeys) { Response.Headers["Surrogate-Key"] = asset.ToSurrogateKey(); } Response.Headers[HeaderNames.ETag] = asset.ToEtag(); return(Ok(response)); }