Class RailwayTrackAttribute
- Namespace
- FunctionalDdd
- Assembly
- FunctionalDdd.RailwayOrientedProgramming.dll
Indicates which railway track an operation executes on. This metadata can be used by IDE extensions, analyzers, and documentation generators.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class RailwayTrackAttribute : Attribute
- Inheritance
-
RailwayTrackAttribute
- Inherited Members
- Extension Methods
Examples
[RailwayTrack(TrackBehavior.Success)]
public static Result<TOut> Bind<T, TOut>(this Result<T> result, Func<T, Result<TOut>> func)
[RailwayTrack(TrackBehavior.Failure)]
public static Result<T> TapOnFailure<T>(this Result<T> result, Action<Error> action)
Remarks
Railway-Oriented Programming uses a railway track metaphor where operations flow along either a success track or a failure track. This attribute makes the track behavior explicit and machine-readable.
Track Behaviors:
Constructors
RailwayTrackAttribute(TrackBehavior)
Initializes a new instance of the RailwayTrackAttribute class.
public RailwayTrackAttribute(TrackBehavior track)
Parameters
trackTrackBehaviorThe track behavior of the operation.
Properties
Track
Gets the track behavior of the annotated operation.
public TrackBehavior Track { get; }