From 76d32f8af21061bec78f79d41fad4108677b34ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 3 Dec 2019 15:51:43 +0300 Subject: [PATCH] Disable document resource cache on development --- .../Volo/Docs/Documents/DocumentAppService.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs index 186f9827b0..d23f071d43 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using Volo.Abp.Application.Services; using Volo.Abp.Caching; using Volo.Docs.Projects; @@ -18,19 +16,21 @@ namespace Volo.Docs.Documents protected IDistributedCache DocumentCache { get; } protected IDistributedCache LanguageCache { get; } protected IDistributedCache ResourceCache { get; } - + protected IHostEnvironment HostEnvironment { get; } public DocumentAppService( IProjectRepository projectRepository, IDocumentStoreFactory documentStoreFactory, IDistributedCache documentCache, IDistributedCache languageCache, - IDistributedCache resourceCache) + IDistributedCache resourceCache, + IHostEnvironment hostEnvironment) { _projectRepository = projectRepository; _documentStoreFactory = documentStoreFactory; DocumentCache = documentCache; LanguageCache = languageCache; ResourceCache = resourceCache; + HostEnvironment = hostEnvironment; } public virtual async Task GetAsync(GetDocumentInput input) @@ -83,7 +83,7 @@ namespace Volo.Docs.Documents return ObjectMapper.Map(documentResource); } - if (Debugger.IsAttached) + if (HostEnvironment.IsDevelopment()) { return await GetResourceAsync(); } @@ -119,7 +119,7 @@ namespace Volo.Docs.Documents return CreateDocumentWithDetailsDto(project, document); } - if (Debugger.IsAttached) + if (HostEnvironment.IsDevelopment()) { return await GetDocumentAsync(); }