File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/Persistence/Wolverine.Marten Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,22 @@ public static StoreManyDocs<T> StoreMany<T>(params T[] documents) where T : notn
5555 return new StoreManyDocs < T > ( documents ) ;
5656 }
5757
58+ /// <summary>
59+ /// Return a side effect of storing an enumerable of potentially mixed documents in Marten
60+ /// </summary>
61+ /// <param name="documents"></param>
62+ /// <returns></returns>
63+ /// <exception cref="ArgumentNullException"></exception>
64+ public static StoreObjects StoreObjects ( params object [ ] documents )
65+ {
66+ if ( documents == null )
67+ {
68+ throw new ArgumentNullException ( nameof ( documents ) ) ;
69+ }
70+
71+ return new StoreObjects ( documents ) ;
72+ }
73+
5874 /// <summary>
5975 /// Return a side effect of inserting the specified document in Marten
6076 /// </summary>
@@ -273,6 +289,18 @@ public override void Execute(IDocumentSession session)
273289 }
274290}
275291
292+ public class StoreObjects : DocumentsOp
293+ {
294+ public StoreObjects ( params object [ ] documents ) : base ( documents ) { }
295+
296+ public StoreObjects ( IList < object > documents ) : this ( documents . ToArray ( ) ) { }
297+
298+ public override void Execute ( IDocumentSession session )
299+ {
300+ session . StoreObjects ( Documents ) ;
301+ }
302+ }
303+
276304public class InsertDoc < T > : DocumentOp where T : notnull
277305{
278306 private readonly T _document ;
You can’t perform that action at this time.
0 commit comments