Browse Source

Merge pull request #23667 from abpframework/IObjectMapper-Context

Use `IObjectMapper` with module context in all modules.
pull/23674/head
Engincan VESKE 1 year ago
committed by GitHub
parent
commit
19a8a41e2e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/GlobalResources/Handlers/GlobalResourceEventHandler.cs
  2. 15
      modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanWebDocumentSectionRenderer.cs

6
modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/GlobalResources/Handlers/GlobalResourceEventHandler.cs

@ -12,12 +12,12 @@ public class GlobalResourceEventHandler :
ILocalEventHandler<EntityUpdatedEventData<GlobalResource>>, ILocalEventHandler<EntityUpdatedEventData<GlobalResource>>,
ITransientDependency ITransientDependency
{ {
public IObjectMapper ObjectMapper { get; } public IObjectMapper<CmsKitPublicApplicationModule> ObjectMapper { get; }
private readonly IDistributedCache<GlobalResourceDto> _resourceCache; private readonly IDistributedCache<GlobalResourceDto> _resourceCache;
public GlobalResourceEventHandler( public GlobalResourceEventHandler(
IDistributedCache<GlobalResourceDto> resourceCache, IDistributedCache<GlobalResourceDto> resourceCache,
IObjectMapper objectMapper) IObjectMapper<CmsKitPublicApplicationModule> objectMapper)
{ {
ObjectMapper = objectMapper; ObjectMapper = objectMapper;
_resourceCache = resourceCache; _resourceCache = resourceCache;
@ -29,4 +29,4 @@ public class GlobalResourceEventHandler :
eventData.Entity.Name, eventData.Entity.Name,
ObjectMapper.Map<GlobalResource, GlobalResourceDto>(eventData.Entity)); ObjectMapper.Map<GlobalResource, GlobalResourceDto>(eventData.Entity));
} }
} }

15
modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanWebDocumentSectionRenderer.cs

@ -1,22 +1,11 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Scriban;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp;
using Volo.Abp.ObjectMapping;
using Volo.Docs.Documents.Rendering; using Volo.Docs.Documents.Rendering;
using Volo.Extensions;
namespace Volo.Docs.HtmlConverting namespace Volo.Docs.HtmlConverting
{ {
public class ScribanWebDocumentSectionRenderer : ScribanDocumentSectionRenderer, IWebDocumentSectionRenderer public class ScribanWebDocumentSectionRenderer : ScribanDocumentSectionRenderer, IWebDocumentSectionRenderer
{ {
private IObjectMapper ObjectMapper { get; set; }
public Task<DocumentNavigationsDto> GetDocumentNavigationsAsync(string documentContent) public Task<DocumentNavigationsDto> GetDocumentNavigationsAsync(string documentContent)
{ {
return GetSectionAsync<DocumentNavigationsDto>(documentContent, DocsNav); return GetSectionAsync<DocumentNavigationsDto>(documentContent, DocsNav);
@ -35,4 +24,4 @@ namespace Volo.Docs.HtmlConverting
return templates; return templates;
} }
} }
} }

Loading…
Cancel
Save