public static class BridgeValidation Writes the validation projection for generated bridge snapshots.
Methods
EnumerateDictionary
public static IEnumerable<BridgeValidationChild> EnumerateDictionary<T>(IEnumerable<KeyValuePair<string, T>> values) Produces keyed entries for generated string dictionary metadata.
EnumerateIndexed
public static IEnumerable<BridgeValidationChild> EnumerateIndexed(IEnumerable values) Produces indexed entries for generated array/list metadata.
Observe
public static IDisposable? Observe<T>(IObservable<T> source, Action changed) Calls changed for every value source produces after the subscription, until the result is disposed. A value replayed while subscribing is not a change. Errors and completion end the observation; a source that was disposed returns null. Generated code observes a ReactiveUI.Validation ValidationContext.ValidationStatusChange with it.
Write
public static void Write(Utf8JsonWriter writer, object root, IReadOnlyList<BridgeDataSubscriptionMember> members) Writes { hasErrors, truncated, errors } for root.
Write
public static void Write(Utf8JsonWriter writer, object root, IReadOnlyList<BridgeDataSubscriptionMember> members, Func<object, IEnumerable?> readObjectErrors) Writes { hasErrors, truncated, errors } for root, reading each object's object-level errors with readObjectErrors.
Parameters
writerThe snapshot writer.
rootThe ViewModel.
membersThe ViewModel's generated member metadata.
readObjectErrorsReturns an object's errors in place of
INotifyDataErrorInfo.GetErrorswithnull, ornullto use that call. An entry is read as an entry ofGetErrors(null): aValidationResultreports at the paths of itsValidationResult.MemberNamesand any other entry at the object's path. Generated code passes a reader for ViewModels that keep their validations in a ReactiveUI.ValidationValidationContext.
WriteMessages
public static void WriteMessages(Utf8JsonWriter writer, IEnumerable? errors) Writes a member's errors, the entries of INotifyDataErrorInfo.GetErrors, as the JSON array of their messages (the {name}Errors state member). An empty message is Invalid value.