Stuart Blackler
(@im5tu | im5tu.io | slid.es/im5tu/epi-content-providers)
Content Search Provider Base (Area/Category)
internal sealed class MyContentProvider : ContentProvider
{
protected IStatusTransitionEvaluator StatusTransitionEvaluator { get; }
public sealed override ContentReference Save(IContent content, SaveAction action)
{
var convertedContent = content as IVersionable;
// ... code ...
var newStatus = StatusTransitionEvaluator.Evaluate(convertedContent, action);
if (newStatus.IsStatusChange())
{
convertedContent.Status = newStatus.NextStatus;
}
// ... code ...
}
}
#if My_Compiler_Switch
protected sealed override void SetCacheSettings(ContentReference contentReference,
IEnumerable<GetChildrenReferenceResult> children, CacheSettings cacheSettings)
{
cacheSettings.CancelCaching = true;
base.SetCacheSettings(contentReference, children, cacheSettings);
}
protected sealed override void SetCacheSettings(ContentReference parentLink, string urlSegment,
IEnumerable<MatchingSegmentResult> childrenMatches, CacheSettings cacheSettings)
{
cacheSettings.CancelCaching = true;
base.SetCacheSettings(parentLink, urlSegment, childrenMatches, cacheSettings);
}
protected sealed override void SetCacheSettings(IContent content, CacheSettings cacheSettings)
{
cacheSettings.CancelCaching = true;
base.SetCacheSettings(content, cacheSettings);
}
#endif
Slides: slid.es/im5tu/epi-content-providers
Questions: @im5tu everywhere