@@ -28,16 +28,17 @@ public ReadAllStreamResult ReadAllAsync(
28
28
ReadDirection = options . Direction switch {
29
29
Direction . Backwards => ReadReq . Types . Options . Types . ReadDirection . Backwards ,
30
30
Direction . Forwards => ReadReq . Types . Options . Types . ReadDirection . Forwards ,
31
- _ => throw InvalidOption ( options . Direction )
31
+ null => ReadReq . Types . Options . Types . ReadDirection . Forwards ,
32
+ _ => throw InvalidOption ( options . Direction . Value )
32
33
} ,
33
- ResolveLinks = options . ResolveLinkTos ,
34
+ ResolveLinks = options . ResolveLinkTos ?? false ,
34
35
All = new ( ) {
35
36
Position = new ( ) {
36
- CommitPosition = options . Position . CommitPosition ,
37
- PreparePosition = options . Position . PreparePosition
37
+ CommitPosition = ( options . Position ?? Position . Start ) . CommitPosition ,
38
+ PreparePosition = ( options . Position ?? Position . Start ) . PreparePosition
38
39
}
39
40
} ,
40
- Count = ( ulong ) options . MaxCount ,
41
+ Count = ( ulong ) ( options . MaxCount ?? long . MaxValue ) ,
41
42
UuidOption = new ( ) { Structured = new ( ) } ,
42
43
ControlOption = new ( ) { Compatibility = 1 } ,
43
44
Filter = GetFilterOptions ( options . Filter )
@@ -213,14 +214,15 @@ public ReadStreamResult ReadStreamAsync(
213
214
ReadDirection = options . Direction switch {
214
215
Direction . Backwards => ReadReq . Types . Options . Types . ReadDirection . Backwards ,
215
216
Direction . Forwards => ReadReq . Types . Options . Types . ReadDirection . Forwards ,
216
- _ => throw InvalidOption ( options . Direction )
217
+ null => ReadReq . Types . Options . Types . ReadDirection . Forwards ,
218
+ _ => throw InvalidOption ( options . Direction . Value )
217
219
} ,
218
- ResolveLinks = options . ResolveLinkTos ,
220
+ ResolveLinks = options . ResolveLinkTos ?? false ,
219
221
Stream = ReadReq . Types . Options . Types . StreamOptions . FromStreamNameAndRevision (
220
222
streamName ,
221
- options . StreamPosition
223
+ options . StreamPosition ?? StreamPosition . Start
222
224
) ,
223
- Count = ( ulong ) options . MaxCount ,
225
+ Count = ( ulong ) ( options . MaxCount ?? long . MaxValue ) ,
224
226
UuidOption = new ( ) { Structured = new ( ) } ,
225
227
NoFilter = new ( ) ,
226
228
ControlOption = new ( ) { Compatibility = 1 }
@@ -443,29 +445,29 @@ IMessageSerializer messageSerializer
443
445
/// </summary>
444
446
public class ReadAllOptions : OperationOptions {
445
447
/// <summary>
446
- /// The <see cref="Direction"/> in which to read.
448
+ /// The <see cref="Direction"/> in which to read. When not provided Forwards is used.
447
449
/// </summary>
448
- public Direction Direction { get ; set ; } = Direction . Forwards ;
450
+ public Direction ? Direction { get ; set ; }
449
451
450
452
/// <summary>
451
- /// The <see cref="Position"/> to start reading from.
453
+ /// The <see cref="Position"/> to start reading from. When not provided Start is used.
452
454
/// </summary>
453
- public Position Position { get ; set ; } = Position . Start ;
455
+ public Position ? Position { get ; set ; }
454
456
455
457
/// <summary>
456
458
/// The <see cref="IEventFilter"/> to apply.
457
459
/// </summary>
458
460
public IEventFilter ? Filter { get ; set ; }
459
461
460
462
/// <summary>
461
- /// The number of events to read from the stream.
463
+ /// The number of events to read from the stream. When not provided, no limit is set.
462
464
/// </summary>
463
- public long MaxCount { get ; set ; } = long . MaxValue ;
465
+ public long ? MaxCount { get ; set ; }
464
466
465
467
/// <summary>
466
- /// Whether to resolve LinkTo events automatically.
468
+ /// Whether to resolve LinkTo events automatically. When not provided, false is used.
467
469
/// </summary>
468
- public bool ResolveLinkTos { get ; set ; }
470
+ public bool ? ResolveLinkTos { get ; set ; }
469
471
470
472
/// <summary>
471
473
/// Allows to customize or disable the automatic deserialization
@@ -476,7 +478,7 @@ public static ReadAllOptions Get() =>
476
478
new ReadAllOptions ( ) ;
477
479
478
480
public ReadAllOptions Forwards ( ) {
479
- Direction = Direction . Forwards ;
481
+ Direction = KurrentDB . Client . Direction . Forwards ;
480
482
481
483
return this ;
482
484
}
@@ -488,7 +490,7 @@ public ReadAllOptions WithFilter(IEventFilter filter) {
488
490
}
489
491
490
492
public ReadAllOptions Backwards ( ) {
491
- Direction = Direction . Backwards ;
493
+ Direction = KurrentDB . Client . Direction . Backwards ;
492
494
493
495
return this ;
494
496
}
@@ -500,10 +502,10 @@ public ReadAllOptions From(Position streamPosition) {
500
502
}
501
503
502
504
public ReadAllOptions FromStart ( ) =>
503
- From ( Position . Start ) ;
505
+ From ( KurrentDB . Client . Position . Start ) ;
504
506
505
507
public ReadAllOptions FromEnd ( ) =>
506
- From ( Position . End ) ;
508
+ From ( KurrentDB . Client . Position . End ) ;
507
509
508
510
public ReadAllOptions WithMaxCount ( long maxCount ) {
509
511
MaxCount = maxCount ;
@@ -539,22 +541,22 @@ public class ReadStreamOptions : OperationOptions {
539
541
/// <summary>
540
542
/// The <see cref="Direction"/> in which to read.
541
543
/// </summary>
542
- public Direction Direction { get ; set ; } = Direction . Forwards ;
544
+ public Direction ? Direction { get ; set ; }
543
545
544
546
/// <summary>
545
547
/// The <see cref="Client.StreamRevision"/> to start reading from.
546
548
/// </summary>
547
- public StreamPosition StreamPosition { get ; set ; } = StreamPosition . Start ;
549
+ public StreamPosition ? StreamPosition { get ; set ; }
548
550
549
551
/// <summary>
550
552
/// The number of events to read from the stream.
551
553
/// </summary>
552
- public long MaxCount { get ; set ; } = long . MaxValue ;
554
+ public long ? MaxCount { get ; set ; }
553
555
554
556
/// <summary>
555
557
/// Whether to resolve LinkTo events automatically.
556
558
/// </summary>
557
- public bool ResolveLinkTos { get ; set ; }
559
+ public bool ? ResolveLinkTos { get ; set ; }
558
560
559
561
/// <summary>
560
562
/// Allows to customize or disable the automatic deserialization
@@ -565,13 +567,13 @@ public static ReadStreamOptions Get() =>
565
567
new ReadStreamOptions ( ) ;
566
568
567
569
public ReadStreamOptions Forwards ( ) {
568
- Direction = Direction . Forwards ;
570
+ Direction = KurrentDB . Client . Direction . Forwards ;
569
571
570
572
return this ;
571
573
}
572
574
573
575
public ReadStreamOptions Backwards ( ) {
574
- Direction = Direction . Backwards ;
576
+ Direction = KurrentDB . Client . Direction . Backwards ;
575
577
576
578
return this ;
577
579
}
@@ -583,10 +585,10 @@ public ReadStreamOptions From(StreamPosition streamPosition) {
583
585
}
584
586
585
587
public ReadStreamOptions FromStart ( ) =>
586
- From ( StreamPosition . Start ) ;
588
+ From ( KurrentDB . Client . StreamPosition . Start ) ;
587
589
588
590
public ReadStreamOptions FromEnd ( ) =>
589
- From ( StreamPosition . End ) ;
591
+ From ( KurrentDB . Client . StreamPosition . End ) ;
590
592
591
593
public ReadStreamOptions WithMaxCount ( long maxCount ) {
592
594
MaxCount = maxCount ;
0 commit comments