public Result <object?>?TryParseValue(string?value, Type type) { if (value.HasText() && value.StartsWith(CurrentUserKey)) { string after = value.Substring(CurrentUserKey.Length).Trim(); string[] parts = after.SplitNoEmpty('.'); return(SimpleMemberEvaluator.EvaluateExpression(UserEntity.Current, parts)); } return(null); }
private static object?GetPropertyValue(AlertEntity alert, string expresion) { var parts = expresion.SplitNoEmpty('.'); var result = SimpleMemberEvaluator.EvaluateExpression(alert, parts); if (result is Result <object?> .Error e) { throw new InvalidOperationException(e.ErrorText); } if (result is Result <object?> .Success s) { return(s.Value); } throw new UnexpectedValueException(result); }