@@ -56,55 +56,55 @@ public SnapshotMetadata(params KeyValuePair<string, string>[] keyValuePairs)
5656 [ JsonIgnore ]
5757 public string AggregateId
5858 {
59- get { return GetMetadataValue ( SnapshotMetadataKeys . AggregateId ) ; }
60- set { Add ( SnapshotMetadataKeys . AggregateId , value ) ; }
59+ get => GetMetadataValue ( SnapshotMetadataKeys . AggregateId ) ;
60+ set => Add ( SnapshotMetadataKeys . AggregateId , value ) ;
6161 }
6262
6363 [ JsonIgnore ]
6464 public string AggregateName
6565 {
66- get { return GetMetadataValue ( SnapshotMetadataKeys . AggregateName ) ; }
67- set { Add ( SnapshotMetadataKeys . AggregateName , value ) ; }
66+ get => GetMetadataValue ( SnapshotMetadataKeys . AggregateName ) ;
67+ set => Add ( SnapshotMetadataKeys . AggregateName , value ) ;
6868 }
6969
7070 [ JsonIgnore ]
7171 public int AggregateSequenceNumber
7272 {
73- get { return GetMetadataValue ( SnapshotMetadataKeys . AggregateSequenceNumber , int . Parse ) ; }
74- set { Add ( SnapshotMetadataKeys . AggregateSequenceNumber , value . ToString ( CultureInfo . InvariantCulture ) ) ; }
73+ get => GetMetadataValue ( SnapshotMetadataKeys . AggregateSequenceNumber , int . Parse ) ;
74+ set => Add ( SnapshotMetadataKeys . AggregateSequenceNumber , value . ToString ( CultureInfo . InvariantCulture ) ) ;
7575 }
7676
7777 [ JsonIgnore ]
7878 public string SnapshotName
7979 {
80- get { return GetMetadataValue ( SnapshotMetadataKeys . SnapshotName ) ; }
81- set { Add ( SnapshotMetadataKeys . SnapshotName , value ) ; }
80+ get => GetMetadataValue ( SnapshotMetadataKeys . SnapshotName ) ;
81+ set => Add ( SnapshotMetadataKeys . SnapshotName , value ) ;
8282 }
8383
8484 [ JsonIgnore ]
8585 public int SnapshotVersion
8686 {
87- get { return GetMetadataValue ( SnapshotMetadataKeys . SnapshotVersion , int . Parse ) ; }
88- set { Add ( SnapshotMetadataKeys . SnapshotVersion , value . ToString ( CultureInfo . InvariantCulture ) ) ; }
87+ get => GetMetadataValue ( SnapshotMetadataKeys . SnapshotVersion , int . Parse ) ;
88+ set => Add ( SnapshotMetadataKeys . SnapshotVersion , value . ToString ( CultureInfo . InvariantCulture ) ) ;
8989 }
9090
9191 [ JsonIgnore ]
9292 public IReadOnlyCollection < ISourceId > PreviousSourceIds
9393 {
9494 get
9595 {
96- return GetMetadataValue ( SnapshotMetadataKeys . PreviousSourceIds , ( json ) =>
97- string . IsNullOrWhiteSpace ( json ) ?
98- Empty :
99- json
100- . Split ( SourceIdSeparators , StringSplitOptions . RemoveEmptyEntries )
101- . Select ( sourceId => new SourceId ( sourceId ) )
102- . ToList ( ) . AsReadOnly ( ) ) ;
96+ if ( ! TryGetValue ( SnapshotMetadataKeys . PreviousSourceIds , out var ids ) ||
97+ string . IsNullOrEmpty ( ids ) )
98+ {
99+ return Empty ;
100+ }
101+
102+ return ids
103+ . Split ( SourceIdSeparators , StringSplitOptions . RemoveEmptyEntries )
104+ . Select ( sourceId => new SourceId ( sourceId ) )
105+ . ToArray ( ) ;
103106 }
104- set { Add ( SnapshotMetadataKeys . PreviousSourceIds , string . Join ( "," , value . Select ( x => x . Value ) ) ) ; }
107+ set => Add ( SnapshotMetadataKeys . PreviousSourceIds , string . Join ( "," , value . Select ( x => x . Value ) ) ) ;
105108 }
106-
107-
108-
109109 }
110- }
110+ }
0 commit comments