diff --git a/src/Persistence/Wolverine.Marten/IMartenOp.cs b/src/Persistence/Wolverine.Marten/IMartenOp.cs
index b5069841..b13518ea 100644
--- a/src/Persistence/Wolverine.Marten/IMartenOp.cs
+++ b/src/Persistence/Wolverine.Marten/IMartenOp.cs
@@ -24,18 +24,35 @@ public static class MartenOps
///
/// Return a side effect of storing the specified document in Marten
///
+ ///
+ ///
+ ///
+ ///
+ public static StoreDoc Store(T document) where T : notnull
+ {
+ if (document == null)
+ {
+ throw new ArgumentNullException(nameof(document));
+ }
+
+ return new StoreDoc(document);
+ }
+
+ ///
+ /// Return a side effect of storing many documents of a specific document type in Marten
+ ///
///
///
///
///
- public static StoreDoc Store(params T[] documents) where T : notnull
+ public static StoreManyDocs StoreMany(params T[] documents) where T : notnull
{
if (documents == null)
{
throw new ArgumentNullException(nameof(documents));
}
- return new StoreDoc(documents);
+ return new StoreManyDocs(documents);
}
///
@@ -225,14 +242,31 @@ public void Execute(IDocumentSession session)
}
public class StoreDoc : DocumentOp where T : notnull
+{
+ private readonly T _document;
+
+ public StoreDoc(T document) : base(document)
+ {
+ _document = document;
+ }
+
+ public override void Execute(IDocumentSession session)
+ {
+ session.Store(_document);
+ }
+}
+
+public class StoreManyDocs : DocumentsOp where T : notnull
{
private readonly T[] _documents;
- public StoreDoc(params T[] documents) : base(documents)
+ public StoreManyDocs(params T[] documents) : base(documents.Cast