Exemplo n.º 1
0
 public static void PreExecutionCheck <T>(ICallistoOperation <T> operation)
     where T : class, IDocumentRoot
 {
     if (operation is null)
     {
         throw new CallistoException("Please provide a valid instance of a 'ICallistoOperation'");
     }
     operation.Validate();
 }
Exemplo n.º 2
0
 public static ICallistoOperation <T> UseSessionHandle <T>(this ICallistoOperation <T> operation, IClientSessionHandle sessionHandle)
     where T : class, IDocumentRoot
 {
     Check.ThrowIfNull(operation, nameof(ICallistoOperation <T>), new CallistoException($"Cannot add a {nameof(IClientSessionHandle)} to a null operation instance"));
     Check.ThrowIfNull(operation, nameof(IClientSessionHandle),
                       new CallistoException($"A {nameof(IClientSessionHandle)} must not be null. Start a session then call this method."));
     operation.ClientSessionHandle = sessionHandle;
     return(operation);
 }
Exemplo n.º 3
0
 public static ICallistoOperation <T> UseCancellationToken <T>(this ICallistoOperation <T> operation, CancellationToken cancellationToken)
     where T : class, IDocumentRoot
 {
     Check.ThrowIfNull(operation, nameof(ICallistoOperation <T>), new CallistoException($"Cannot add a {nameof(CancellationToken)} to a null operation instance"));
     if (cancellationToken == CancellationToken.None)
     {
         return(operation);
     }
     operation.CancellationToken = cancellationToken;
     return(operation);
 }