Exemplo n.º 1
0
 /// <summary>
 /// Executes an aggregation framework pipeline by supplying a 'Template' object
 /// </summary>
 /// <typeparam name="T">Any class that implements IEntity</typeparam>
 /// <typeparam name="TResult">The type of the resulting objects</typeparam>
 /// <param name="template">A 'Template' object with tags replaced</param>
 /// <param name="options">The options for the aggregation. This is not required.</param>
 /// <param name="session">An optional session if using within a transaction</param>
 public Task <IAsyncCursor <TResult> > AggregateAsync <T, TResult>(Template <T, TResult> template, AggregateOptions options = null, IClientSessionHandle session = null, CancellationToken cancellation = default, bool _ = false) where T : IEntity
 {
     return(AggregateAsync(template, options, session, cancellation));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Executes an aggregation framework pipeline by supplying a 'Template' object
 /// </summary>
 /// <typeparam name="T">Any class that implements IEntity</typeparam>
 /// <typeparam name="TResult">The type of the resulting objects</typeparam>
 /// <param name="template">A 'Template' object with tags replaced</param>
 /// <param name="options">The options for the aggregation. This is not required.</param>
 /// <param name="session">An optional session if using within a transaction</param>
 /// <param name="cancellation">An optional cancellation token</param>
 public static Task <IAsyncCursor <TResult> > AggregateAsync <T, TResult>(Template <T, TResult> template, AggregateOptions options = null, IClientSessionHandle session = null, CancellationToken cancellation = default) where T : IEntity
 {
     return(session == null
            ? Collection <T>().AggregateAsync(template.ToPipeline(), options, cancellation)
            : Collection <T>().AggregateAsync(session, template.ToPipeline(), options, cancellation));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Specify an update with a Template to modify the Entities (use multiple times if needed)
 /// </summary>
 /// <param name="template">A Template with a single update</param>
 public Update <T> Modify(Template template)
 {
     Modify(template.ToString());
     return(this);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Specify the Entity matching criteria with a Template
 /// </summary>
 /// <param name="template">The filter Template</param>
 public Update <T> Match(Template template)
 {
     filter = template.ToString();
     return(this);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Specify a single array filter using a Template to target nested entities for updates
 /// </summary>
 /// <param name="template"></param>
 public Update <T> WithArrayFilter(Template template)
 {
     WithArrayFilter(template.ToString());
     return(this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Specify an update pipeline stage using a Template to modify the Entities (use multiple times if needed)
 /// <para>NOTE: pipeline updates and regular updates cannot be used together.</para>
 /// </summary>
 /// <param name="template">A Template object containing a pipeline stage</param>
 public Update <T> WithPipelineStage(Template template)
 {
     return(WithPipelineStage(template.ToString()));
 }