Skip to content

Instantly share code, notes, and snippets.

@KevinJump
Last active October 13, 2022 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KevinJump/80b584c74b7a9808af1a87e9afcc94b6 to your computer and use it in GitHub Desktop.
Save KevinJump/80b584c74b7a9808af1a87e9afcc94b6 to your computer and use it in GitHub Desktop.
Note: this can now be done in usync with no custom code : https://github.com/KevinJump/uSync/releases/tag/8.4.4
/// ****************************************************
/// NOTE: As of uSync 8.8.4 this functionaliy exists in the core of the package
/// https://github.com/KevinJump/uSync/releases/tag/8.4.4
///
/// With ContentEdition Installed you can move the dictionayHandler with a Group="Settings" attribute in the config file.
/// ****************************************************
/// uSync Dictionary Handler
/// untested code - in theory this would make a dictionary handler that synced with the settings group in uSync not the content one.
/// you would need to update your usync8.config.
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using uSync8.BackOffice;
using uSync8.BackOffice.Services;
using uSync8.BackOffice.SyncHandlers;
using uSync8.ContentEdition.Handlers;
using uSync8.Core;
using uSync8.Core.Dependency;
using uSync8.Core.Serialization;
using uSync8.Core.Tracking;
using static Umbraco.Core.Constants;
namespace CustomeHandlers
{
[SyncHandler("settingsDictionaryHandler", "Dictionary", "Dictionary", uSyncBackOfficeConstants.Priorites.DictionaryItems
, Icon = "icon-book-alt usync-addon-icon", EntityType = UdiEntityType.DictionaryItem)]
public class SettingsDictionary : DictionaryHandler
{
public SettingsDictionary(ILocalizationService localizationService, IEntityService entityService, IProfilingLogger logger, AppCaches appCaches, ISyncSerializer<IDictionaryItem> serializer, ISyncItemFactory syncItemFactory, SyncFileService syncFileService)
: base(localizationService, entityService, logger, appCaches, serializer, syncItemFactory, syncFileService)
{ }
protected SettingsDictionary(IEntityService entityService, IProfilingLogger logger, ILocalizationService localizationService, ISyncSerializer<IDictionaryItem> serializer, ISyncTracker<IDictionaryItem> tracker, AppCaches appCaches, ISyncDependencyChecker<IDictionaryItem> checker, SyncFileService syncFileService)
: base(entityService, logger, localizationService, serializer, tracker, appCaches, checker, syncFileService)
{ }
public override string Group => uSyncBackOfficeConstants.Groups.Settings;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment