Struct HopLoadResult
Result of loading a single related resource at one ID during a hop walk.
public readonly struct HopLoadResult
- Inherited Members
Remarks
HopLoadResult uses an explicit success flag rather than inferring
success from the presence of an error. The default instance is a failure
(with a sentinel Error) so a misconfigured hop loader cannot
accidentally produce a "successful" result carrying null as the loaded
value, which would bypass the empty-list / failed-load short-circuits in
ResourceAuthorizationViaBehavior<TMessage, TLeaf, TOwner, TResponse>.
Properties
Error
Gets the loader's error when failed or uninitialized; null when successful.
public Error? Error { get; }
Property Value
IsSuccess
Gets a value indicating whether the load succeeded. false for
default(HopLoadResult) so a misconfigured hop loader cannot accidentally
pass a null value through the pipeline.
public bool IsSuccess { get; }
Property Value
Value
Gets the loaded value when successful; null when failed.
public object? Value { get; }
Property Value
Methods
Failure(Error)
Creates a failure result carrying the loader's error.
public static HopLoadResult Failure(Error error)
Parameters
errorErrorThe loader's error. Must not be null.
Returns
Exceptions
- ArgumentNullException
Thrown when
erroris null.
Success(object)
Creates a success result carrying the loaded value.
public static HopLoadResult Success(object value)
Parameters
valueobjectThe loaded resource. Must not be null.
Returns
Exceptions
- ArgumentNullException
Thrown when
valueis null.