Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public static void ReplaceSetting(OperationSettings setting)
 {
     Manager.Settings.GetOrAddDefinition(setting.OverridenType)[setting.OperationSymbol] = setting;
     Manager.Settings.ClearCache();
 }
Ejemplo n.º 3
0
 public static void AddSetting(OperationSettings setting)
 {
     Manager.Settings.GetOrAddDefinition(setting.OverridenType).AddOrThrow(setting.OperationSymbol, setting, "{0} repeated");
 }
Ejemplo n.º 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);
        }