Exemplo n.º 1
0
        public object RemoveComponentSetting(string componentUid, string uid)
        {
            if (componentUid == null)
            {
                throw new ArgumentNullException(nameof(componentUid));
            }
            if (uid == null)
            {
                throw new ArgumentNullException(nameof(uid));
            }

            var component = GetComponent(componentUid);

            if (!component.RemoveSetting(uid, out var value))
            {
                return(null);
            }

            _logger.LogDebug(
                "Component setting removed: [Component={0}] [Setting UID={1}].",
                component.Uid,
                uid);

            _storageService.Write(component.GetSettings(), ComponentsDirectory, component.Uid, DefaultFileNames.Settings);
            _messageBusWrapper.PublishSettingRemovedEvent(component.Uid, uid, value);

            return(value);
        }
Exemplo n.º 2
0
        public object RemoveComponentSetting(string componentUid, string settingUid)
        {
            if (componentUid == null)
            {
                throw new ArgumentNullException(nameof(componentUid));
            }
            if (settingUid == null)
            {
                throw new ArgumentNullException(nameof(settingUid));
            }

            var component = GetComponent(componentUid);

            component.Settings.Remove(settingUid, out var value);

            _storageService.Write(component.Settings, ComponentsDirectory, component.Uid, DefaultFilenames.Settings);
            _messageBusWrapper.PublishSettingRemovedEvent(component.Uid, settingUid, value);

            return(value);
        }