mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixing blueprint element caching bug.
This fixes the issue where blueprint elements were still available even after deleting them. The fix is to evict the cached element descriptors when a blueprint element is deleted.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Orchard.Caching;
|
||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.Layouts.Framework.Elements;
|
using Orchard.Layouts.Framework.Elements;
|
||||||
using Orchard.Layouts.Models;
|
using Orchard.Layouts.Models;
|
||||||
@@ -7,8 +8,11 @@ using Orchard.Layouts.Models;
|
|||||||
namespace Orchard.Layouts.Services {
|
namespace Orchard.Layouts.Services {
|
||||||
public class ElementBlueprintService : IElementBlueprintService {
|
public class ElementBlueprintService : IElementBlueprintService {
|
||||||
private readonly IRepository<ElementBlueprint> _blueprintRepository;
|
private readonly IRepository<ElementBlueprint> _blueprintRepository;
|
||||||
public ElementBlueprintService(IRepository<ElementBlueprint> blueprintRepository) {
|
private readonly ISignals _signals;
|
||||||
|
|
||||||
|
public ElementBlueprintService(IRepository<ElementBlueprint> blueprintRepository, ISignals signals) {
|
||||||
_blueprintRepository = blueprintRepository;
|
_blueprintRepository = blueprintRepository;
|
||||||
|
_signals = signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementBlueprint GetBlueprint(int id) {
|
public ElementBlueprint GetBlueprint(int id) {
|
||||||
@@ -21,6 +25,7 @@ namespace Orchard.Layouts.Services {
|
|||||||
|
|
||||||
public void DeleteBlueprint(ElementBlueprint blueprint) {
|
public void DeleteBlueprint(ElementBlueprint blueprint) {
|
||||||
_blueprintRepository.Delete(blueprint);
|
_blueprintRepository.Delete(blueprint);
|
||||||
|
_signals.Trigger(Signals.ElementDescriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int DeleteBlueprints(IEnumerable<int> ids) {
|
public int DeleteBlueprints(IEnumerable<int> ids) {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ namespace Orchard.Layouts.Services {
|
|||||||
descriptor.Elements.Add(element);
|
descriptor.Elements.Add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acquireContext.Monitor(_signals.When(Signals.ElementDescriptors));
|
||||||
return categoryDescriptorDictionary.Values.OrderBy(x => x.Position);
|
return categoryDescriptorDictionary.Values.OrderBy(x => x.Position);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user