Example #1
0
            protected override void OnDelete(T entity, object?[]?args)
            {
                AssertGetState();
                S oldState = Graph <T, S> .GetStateFunc(entity);

                base.OnDelete(entity, args);
            }
Example #2
0
            protected override string?OnCanDelete(T entity)
            {
                S state = Graph <T, S> .GetStateFunc(entity);

                if (!FromStates.Contains(state))
                {
                    return(OperationMessage.StateShouldBe0InsteadOf1.NiceToString().FormatWith(
                               FromStates.CommaOr(v => ((Enum?)(object?)v)?.NiceToString() ?? "null"),
                               ((Enum?)(object?)state)?.NiceToString() ?? "null"));
                }

                return(base.OnCanDelete(entity));
            }
            protected override string OnCanExecute(T entity)
            {
                S state = Graph <T, S> .GetStateFunc(entity);

                if (!FromStates.Contains(state))
                {
                    return(OperationMessage.StateShouldBe0InsteadOf1.NiceToString().FormatWith(
                               FromStates.CommaOr(v => ((Enum)(object)v).NiceToString()),
                               ((Enum)(object)state).NiceToString()));
                }

                return(base.OnCanExecute(entity));
            }