public OS GetSettings <OS>(Type type, OperationSymbol operation)
            where OS : OperationSettings
        {
            OperationSettings settings = Settings.TryGetValue(type)?.TryGetC(operation);

            if (settings != null)
            {
                var result = settings as OS;

                if (result == null)
                {
                    throw new InvalidOperationException("{0}({1}) should be a {2}".FormatWith(settings.GetType().TypeName(), operation.Key, typeof(OS).TypeName()));
                }

                return(result);
            }

            return(null);
        }
 public static void ReplaceSetting(OperationSettings setting)
 {
     Manager.Settings.GetOrAddDefinition(setting.OverridenType)[setting.OperationSymbol] = setting;
     Manager.Settings.ClearCache();
 }
 public static void AddSetting(OperationSettings setting)
 {
     Manager.Settings.GetOrAddDefinition(setting.OverridenType).AddOrThrow(setting.OperationSymbol, setting, "{0} repeated");
 }
Example #4
0
        public JsOperationOptions Options()
        {
            var result = new JsOperationOptions(OperationInfo.OperationSymbol, this.Prefix)
            {
                isLite = OperationInfo.Lite
            };

            result.confirmMessage = OperationSettings != null && OperationSettings.ConfirmMessage != null?OperationSettings.ConfirmMessage(this) :
                                        OperationInfo.OperationType == OperationType.Delete ? OperationMessage.PleaseConfirmYouDLikeToDeleteTheEntityFromTheSystem.NiceToString() : null;

            return(result);
        }