@@ -23,8 +23,8 @@ public partial class BulkDescriptor
2323 private BulkDescriptor AddOperation ( IBulkOperation operation ) => Assign ( a => a . Operations . AddIfNotNull ( operation ) ) ;
2424
2525 public BulkDescriptor Create < T > ( Func < BulkCreateDescriptor < T > , IBulkCreateOperation < T > > bulkCreateSelector ) where T : class =>
26- Assign ( a => AddOperation ( bulkCreateSelector ? . Invoke ( new BulkCreateDescriptor < T > ( ) ) ) ) ;
27-
26+ Assign ( a => AddOperation ( bulkCreateSelector ? . Invoke ( new BulkCreateDescriptor < T > ( ) ) ) ) ;
27+
2828 /// <summary>
2929 /// CreateMany, convenience method to create many documents at once.
3030 /// </summary>
@@ -34,8 +34,8 @@ public BulkDescriptor CreateMany<T>(IEnumerable<T> @objects, Func<BulkCreateDesc
3434 Assign ( a => @objects . ForEach ( o => AddOperation ( bulkCreateSelector . InvokeOrDefault ( new BulkCreateDescriptor < T > ( ) . Document ( o ) , o ) ) ) ) ;
3535
3636 public BulkDescriptor Index < T > ( Func < BulkIndexDescriptor < T > , IBulkIndexOperation < T > > bulkIndexSelector ) where T : class =>
37- Assign ( a => AddOperation ( bulkIndexSelector ? . Invoke ( new BulkIndexDescriptor < T > ( ) ) ) ) ;
38-
37+ Assign ( a => AddOperation ( bulkIndexSelector ? . Invoke ( new BulkIndexDescriptor < T > ( ) ) ) ) ;
38+
3939 /// <summary>
4040 /// IndexMany, convenience method to pass many objects at once.
4141 /// </summary>
@@ -48,32 +48,50 @@ public BulkDescriptor Delete<T>(T obj, Func<BulkDeleteDescriptor<T>, IBulkDelete
4848 Assign ( a => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Document ( obj ) ) ) ) ;
4949
5050 public BulkDescriptor Delete < T > ( Func < BulkDeleteDescriptor < T > , IBulkDeleteOperation < T > > bulkDeleteSelector ) where T : class =>
51- Assign ( a => AddOperation ( bulkDeleteSelector ? . Invoke ( new BulkDeleteDescriptor < T > ( ) ) ) ) ;
52-
51+ Assign ( a => AddOperation ( bulkDeleteSelector ? . Invoke ( new BulkDeleteDescriptor < T > ( ) ) ) ) ;
52+
5353 /// <summary>
5454 /// DeleteMany, convenience method to delete many objects at once.
5555 /// </summary>
5656 /// <param name="objects">the objects to delete</param>
5757 /// <param name="bulkDeleteSelector">A func called on each object to describe the individual delete operation</param>
5858 public BulkDescriptor DeleteMany < T > ( IEnumerable < T > @objects , Func < BulkDeleteDescriptor < T > , T , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
59- Assign ( a => @objects . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Document ( o ) , o ) ) ) ) ;
60-
59+ Assign ( a => @objects . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Document ( o ) , o ) ) ) ) ;
60+
6161 /// <summary>
6262 /// DeleteMany, convenience method to delete many objects at once.
6363 /// </summary>
6464 /// <param name="ids">Enumerable of string ids to delete</param>
6565 /// <param name="bulkDeleteSelector">A func called on each ids to describe the individual delete operation</param>
66- public BulkDescriptor DeleteMany < T > ( IEnumerable < string > ids , Func < BulkDeleteDescriptor < T > , string , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
67- Assign ( a => ids . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Id ( o ) , o ) ) ) ) ;
68-
66+ public BulkDescriptor DeleteMany < T > ( IEnumerable < string > ids , Func < BulkDeleteDescriptor < T > , string , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
67+ Assign ( a => ids . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Id ( o ) , o ) ) ) ) ;
68+
6969 /// <summary>
7070 /// DeleteMany, convenience method to delete many objects at once.
7171 /// </summary>
7272 /// <param name="ids">Enumerable of int ids to delete</param>
7373 /// <param name="bulkDeleteSelector">A func called on each ids to describe the individual delete operation</param>
7474 public BulkDescriptor DeleteMany < T > ( IEnumerable < long > ids , Func < BulkDeleteDescriptor < T > , long , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
75- Assign ( a => ids . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Id ( o ) , o ) ) ) ) ;
76-
75+ Assign ( a => ids . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Id ( o ) , o ) ) ) ) ;
76+
77+ /// <summary>
78+ /// Updatemany, convenience method to pass many objects at once to do multiple updates.
79+ /// </summary>
80+ /// <param name="objects">the objects to update</param>
81+ /// <param name="bulkUpdateSelector">An func called on each object to describe the individual update operation</param>
82+ public BulkDescriptor UpdateMany < T > ( IEnumerable < T > @objects , Func < BulkUpdateDescriptor < T , T > , T , IBulkUpdateOperation < T , T > > bulkUpdateSelector ) where T : class =>
83+ Assign ( a => @objects . ForEach ( o => AddOperation ( bulkUpdateSelector . InvokeOrDefault ( new BulkUpdateDescriptor < T , T > ( ) . IdFrom ( o ) , o ) ) ) ) ;
84+
85+ /// <summary>
86+ /// Updatemany, convenience method to pass many objects at once to do multiple updates.
87+ /// </summary>
88+ /// <param name="objects">the objects to update</param>
89+ /// <param name="bulkUpdateSelector">An func called on each object to describe the individual update operation</param>
90+ public BulkDescriptor UpdateMany < T , TPartialDocument > ( IEnumerable < T > @objects , Func < BulkUpdateDescriptor < T , TPartialDocument > , T , IBulkUpdateOperation < T , TPartialDocument > > bulkUpdateSelector )
91+ where T : class
92+ where TPartialDocument : class =>
93+ Assign ( a => @objects . ForEach ( o => AddOperation ( bulkUpdateSelector . InvokeOrDefault ( new BulkUpdateDescriptor < T , TPartialDocument > ( ) . IdFrom ( o ) , o ) ) ) ) ;
94+
7795 public BulkDescriptor Update < T > ( Func < BulkUpdateDescriptor < T , T > , IBulkUpdateOperation < T , T > > bulkUpdateSelector ) where T : class =>
7896 this . Update < T , T > ( bulkUpdateSelector ) ;
7997
0 commit comments