@@ -55,7 +55,7 @@ public static Task<IWriteResult> AddAsync<TState>(
5555 null ,
5656 ct
5757 ) ;
58-
58+
5959 public static Task < IWriteResult > AddAsync < TState > (
6060 this IStateStore < TState > stateStore ,
6161 string streamName ,
@@ -68,13 +68,14 @@ public static Task<IWriteResult> AddAsync<TState>(
6868 new AppendToStreamOptions { ExpectedStreamState = StreamState . NoStream } ,
6969 ct
7070 ) ;
71-
71+
7272 public static Task < IWriteResult > AddAsync < TState , TEvent > (
7373 this IStateStore < TState > stateStore ,
7474 string streamName ,
7575 IEnumerable < TEvent > events ,
7676 CancellationToken ct = default
77- ) where TState : notnull where TEvent : notnull =>
77+ ) where TState : notnull
78+ where TEvent : notnull =>
7879 stateStore . AddAsync (
7980 streamName ,
8081 events . Select ( e => Message . From ( e ) ) ,
@@ -87,7 +88,8 @@ public static Task<IWriteResult> UpdateAsync<TState, TEvent>(
8788 string streamName ,
8889 IEnumerable < TEvent > events ,
8990 CancellationToken ct = default
90- ) where TState : notnull where TEvent : notnull =>
91+ ) where TState : notnull
92+ where TEvent : notnull =>
9193 stateStore . UpdateAsync (
9294 streamName ,
9395 events . Select ( e => Message . From ( e ) ) ,
@@ -114,7 +116,8 @@ public static Task<IWriteResult> UpdateAsync<TState, TEvent>(
114116 IEnumerable < TEvent > events ,
115117 StreamRevision expectedStreamRevision ,
116118 CancellationToken ct = default
117- ) where TState : notnull where TEvent : notnull =>
119+ ) where TState : notnull
120+ where TEvent : notnull =>
118121 stateStore . UpdateAsync (
119122 streamName ,
120123 events . Select ( e => Message . From ( e ) ) ,
@@ -154,7 +157,21 @@ public static Task<IWriteResult> Handle<TState, TEvent>(
154157 string streamName ,
155158 Func < TState , TEvent [ ] > handle ,
156159 CancellationToken ct = default
157- ) where TState : notnull where TEvent : notnull =>
160+ ) where TState : notnull
161+ where TEvent : notnull =>
162+ stateStore . Handle (
163+ streamName ,
164+ ( state , _ ) => new ValueTask < Message [ ] > ( handle ( state ) . Select ( m => Message . From ( m ) ) . ToArray ( ) ) ,
165+ null ,
166+ ct
167+ ) ;
168+
169+ public static Task < IWriteResult > Handle < TState > (
170+ this IStateStore < TState > stateStore ,
171+ string streamName ,
172+ Func < TState , object [ ] > handle ,
173+ CancellationToken ct = default
174+ ) where TState : notnull =>
158175 stateStore . Handle (
159176 streamName ,
160177 ( state , _ ) => new ValueTask < Message [ ] > ( handle ( state ) . Select ( m => Message . From ( m ) ) . ToArray ( ) ) ,
@@ -168,7 +185,22 @@ public static Task<IWriteResult> Handle<TState, TEvent>(
168185 Func < TState , TEvent [ ] > handle ,
169186 DecideOptions < TState > ? decideOptions ,
170187 CancellationToken ct = default
171- ) where TState : notnull where TEvent : notnull =>
188+ ) where TState : notnull
189+ where TEvent : notnull =>
190+ stateStore . Handle (
191+ streamName ,
192+ ( state , _ ) => new ValueTask < Message [ ] > ( handle ( state ) . Select ( m => Message . From ( m ) ) . ToArray ( ) ) ,
193+ decideOptions ,
194+ ct
195+ ) ;
196+
197+ public static Task < IWriteResult > Handle < TState > (
198+ this IStateStore < TState > stateStore ,
199+ string streamName ,
200+ Func < TState , object [ ] > handle ,
201+ DecideOptions < TState > ? decideOptions ,
202+ CancellationToken ct = default
203+ ) where TState : notnull =>
172204 stateStore . Handle (
173205 streamName ,
174206 ( state , _ ) => new ValueTask < Message [ ] > ( handle ( state ) . Select ( m => Message . From ( m ) ) . ToArray ( ) ) ,
@@ -179,7 +211,7 @@ public static Task<IWriteResult> Handle<TState, TEvent>(
179211
180212public class StateStore < TState > ( KurrentClient client , StateStoreOptions < TState > options )
181213 : IStateStore < TState >
182- where TState : notnull {
214+ where TState : notnull {
183215 public virtual Task < StateAtPointInTime < TState > > Get ( string streamName , CancellationToken ct = default ) =>
184216 client . GetStateAsync ( streamName , options . StateBuilder , options . GetStreamStateOptions , ct ) ;
185217
0 commit comments