@@ -22,67 +22,64 @@ public partial class BulkDescriptor
22
22
23
23
private BulkDescriptor AddOperation ( IBulkOperation operation ) => Assign ( a => a . Operations . AddIfNotNull ( operation ) ) ;
24
24
25
- public BulkDescriptor Create < T > ( Func < BulkCreateDescriptor < T > , BulkCreateDescriptor < T > > bulkCreateSelector ) where T : class =>
25
+ public BulkDescriptor Create < T > ( Func < BulkCreateDescriptor < T > , IBulkCreateOperation < T > > bulkCreateSelector ) where T : class =>
26
26
Assign ( a => AddOperation ( bulkCreateSelector ? . Invoke ( new BulkCreateDescriptor < T > ( ) ) ) ) ;
27
27
28
28
/// <summary>
29
29
/// CreateMany, convenience method to create many documents at once.
30
30
/// </summary>
31
31
/// <param name="objects">the objects to create</param>
32
32
/// <param name="bulkCreateSelector">A func called on each object to describe the individual create operation</param>
33
- public BulkDescriptor CreateMany < T > ( IEnumerable < T > @objects , Func < BulkCreateDescriptor < T > , T , BulkCreateDescriptor < T > > bulkCreateSelector = null ) where T : class =>
33
+ public BulkDescriptor CreateMany < T > ( IEnumerable < T > @objects , Func < BulkCreateDescriptor < T > , T , IBulkCreateOperation < T > > bulkCreateSelector = null ) where T : class =>
34
34
Assign ( a => @objects . ForEach ( o => AddOperation ( bulkCreateSelector . InvokeOrDefault ( new BulkCreateDescriptor < T > ( ) . Document ( o ) , o ) ) ) ) ;
35
-
36
- //public BulkDescriptor Index<T>(T obj, Func<BulkIndexDescriptor<T>, BulkIndexDescriptor<T>> bulkIndexSelector = null) where T : class =>
37
- // Assign(a => AddOperation(bulkIndexSelector.InvokeOrDefault(new BulkIndexDescriptor<T>()).Document(obj)));
38
35
39
- public BulkDescriptor Index < T > ( Func < BulkIndexDescriptor < T > , BulkIndexDescriptor < T > > bulkIndexSelector ) where T : class =>
36
+ public BulkDescriptor Index < T > ( Func < BulkIndexDescriptor < T > , IIndexOperation < T > > bulkIndexSelector ) where T : class =>
40
37
Assign ( a => AddOperation ( bulkIndexSelector ? . Invoke ( new BulkIndexDescriptor < T > ( ) ) ) ) ;
41
38
42
39
/// <summary>
43
40
/// IndexMany, convenience method to pass many objects at once.
44
41
/// </summary>
45
42
/// <param name="objects">the objects to index</param>
46
43
/// <param name="bulkIndexSelector">A func called on each object to describe the individual index operation</param>
47
- public BulkDescriptor IndexMany < T > ( IEnumerable < T > @objects , Func < BulkIndexDescriptor < T > , T , BulkIndexDescriptor < T > > bulkIndexSelector = null ) where T : class =>
44
+ public BulkDescriptor IndexMany < T > ( IEnumerable < T > @objects , Func < BulkIndexDescriptor < T > , T , IIndexOperation < T > > bulkIndexSelector = null ) where T : class =>
48
45
Assign ( a => @objects . ForEach ( o => AddOperation ( bulkIndexSelector . InvokeOrDefault ( new BulkIndexDescriptor < T > ( ) . Document ( o ) , o ) ) ) ) ;
49
46
50
- public BulkDescriptor Delete < T > ( T obj , Func < BulkDeleteDescriptor < T > , BulkDeleteDescriptor < T > > bulkDeleteSelector = null ) where T : class =>
47
+ public BulkDescriptor Delete < T > ( T obj , Func < BulkDeleteDescriptor < T > , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
51
48
Assign ( a => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Document ( obj ) ) ) ) ;
52
49
53
- public BulkDescriptor Delete < T > ( Func < BulkDeleteDescriptor < T > , BulkDeleteDescriptor < T > > bulkDeleteSelector ) where T : class =>
50
+ public BulkDescriptor Delete < T > ( Func < BulkDeleteDescriptor < T > , IBulkDeleteOperation < T > > bulkDeleteSelector ) where T : class =>
54
51
Assign ( a => AddOperation ( bulkDeleteSelector ? . Invoke ( new BulkDeleteDescriptor < T > ( ) ) ) ) ;
55
52
56
53
/// <summary>
57
54
/// DeleteMany, convenience method to delete many objects at once.
58
55
/// </summary>
59
56
/// <param name="objects">the objects to delete</param>
60
57
/// <param name="bulkDeleteSelector">A func called on each object to describe the individual delete operation</param>
61
- public BulkDescriptor DeleteMany < T > ( IEnumerable < T > @objects , Func < BulkDeleteDescriptor < T > , T , BulkDeleteDescriptor < T > > bulkDeleteSelector = null ) where T : class =>
58
+ public BulkDescriptor DeleteMany < T > ( IEnumerable < T > @objects , Func < BulkDeleteDescriptor < T > , T , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
62
59
Assign ( a => @objects . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Document ( o ) , o ) ) ) ) ;
63
60
64
61
/// <summary>
65
62
/// DeleteMany, convenience method to delete many objects at once.
66
63
/// </summary>
67
64
/// <param name="ids">Enumerable of string ids to delete</param>
68
65
/// <param name="bulkDeleteSelector">A func called on each ids to describe the individual delete operation</param>
69
- public BulkDescriptor DeleteMany < T > ( IEnumerable < string > ids , Func < BulkDeleteDescriptor < T > , string , BulkDeleteDescriptor < T > > bulkDeleteSelector = null ) where T : class =>
66
+ public BulkDescriptor DeleteMany < T > ( IEnumerable < string > ids , Func < BulkDeleteDescriptor < T > , string , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
70
67
Assign ( a => ids . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Id ( o ) , o ) ) ) ) ;
71
68
72
69
/// <summary>
73
70
/// DeleteMany, convenience method to delete many objects at once.
74
71
/// </summary>
75
72
/// <param name="ids">Enumerable of int ids to delete</param>
76
73
/// <param name="bulkDeleteSelector">A func called on each ids to describe the individual delete operation</param>
77
- public BulkDescriptor DeleteMany < T > ( IEnumerable < long > ids , Func < BulkDeleteDescriptor < T > , long , BulkDeleteDescriptor < T > > bulkDeleteSelector = null ) where T : class =>
74
+ public BulkDescriptor DeleteMany < T > ( IEnumerable < long > ids , Func < BulkDeleteDescriptor < T > , long , IBulkDeleteOperation < T > > bulkDeleteSelector = null ) where T : class =>
78
75
Assign ( a => ids . ForEach ( o => AddOperation ( bulkDeleteSelector . InvokeOrDefault ( new BulkDeleteDescriptor < T > ( ) . Id ( o ) , o ) ) ) ) ;
79
76
80
- public BulkDescriptor Update < T > ( Func < BulkUpdateDescriptor < T , T > , BulkUpdateDescriptor < T , T > > bulkUpdateSelector ) where T : class =>
77
+ public BulkDescriptor Update < T > ( Func < BulkUpdateDescriptor < T , T > , IBulkUpdateOperation < T , T > > bulkUpdateSelector ) where T : class =>
81
78
this . Update < T , T > ( bulkUpdateSelector ) ;
82
79
83
- public BulkDescriptor Update < T , K > ( Func < BulkUpdateDescriptor < T , K > , BulkUpdateDescriptor < T , K > > bulkUpdateSelector )
80
+ public BulkDescriptor Update < T , TPartialDocument > ( Func < BulkUpdateDescriptor < T , TPartialDocument > , IBulkUpdateOperation < T , TPartialDocument > > bulkUpdateSelector )
84
81
where T : class
85
- where K : class =>
86
- Assign ( a => AddOperation ( bulkUpdateSelector ? . Invoke ( new BulkUpdateDescriptor < T , K > ( ) ) ) ) ;
82
+ where TPartialDocument : class =>
83
+ Assign ( a => AddOperation ( bulkUpdateSelector ? . Invoke ( new BulkUpdateDescriptor < T , TPartialDocument > ( ) ) ) ) ;
87
84
}
88
85
}
0 commit comments