Beispiel #1
0
        /// <summary>
        /// Specifies the consistency guarantee/constraint for index scanning.
        /// </summary>
        /// <param name="scanConsistency">Specify the consistency guarantee/constraint for index scanning.</param>
        /// <returns>
        /// A reference to the current <see cref="QueryOptions" /> for method chaining.
        /// </returns>
        /// <exception cref="NotSupportedException">StatementPlus are not currently supported by CouchbaseServer.</exception>
        /// <remarks>
        /// Optional.
        /// </remarks>
        public QueryOptions ScanConsistency(QueryScanConsistency scanConsistency)
        {
#pragma warning disable 618
            if (scanConsistency == QueryScanConsistency.StatementPlus)
#pragma warning restore 618
            {
                throw new NotSupportedException(
                          "AtPlus and StatementPlus are not currently supported by CouchbaseServer.");
            }

            _scanConsistency = scanConsistency;
            return(this);
        }
Beispiel #2
0
        /// <summary>
        /// Specifies the consistency guarantee/constraint for index scanning.
        /// </summary>
        /// <param name="source">Sets scan consistency for this query.  Must be a Couchbase LINQ query.</param>
        /// <param name="scanConsistency">Specify the consistency guarantee/constraint for index scanning.</param>
        /// <remarks>The default is <see cref="QueryScanConsistency.NotBounded"/>.</remarks>
        public static IQueryable <T> ScanConsistency <T>(this IQueryable <T> source, QueryScanConsistency scanConsistency)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(source.Provider.CreateQuery <T>(
                       Expression.Call(
                           QueryExtensionMethods.ScanConsistency.MakeGenericMethod(typeof(T)),
                           source.Expression,
                           Expression.Constant(scanConsistency))));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ScanConsistencyClause" /> class.
 /// </summary>
 /// <param name="scanConsistency">Scan consistency for the query.</param>
 /// <param name="scanWait">Time to wait for index scan.</param>
 public ScanConsistencyClause(QueryScanConsistency scanConsistency, TimeSpan?scanWait)
 {
     ScanConsistency = scanConsistency;
     ScanWait        = scanWait;
 }