public static int GetLimit(this ICommandOptions options)
        {
            int limit = options.SafeGetOption(SetPagingOptionsExtensions.PageLimitKey, options.SafeGetOption(SetPagingOptionsExtensions.DefaultPageLimitKey, 10));

            int maxLimit = options.SafeGetOption(SetPagingOptionsExtensions.MaxPageLimitKey, 10000);

            if (limit > maxLimit)
            {
                return(maxLimit);
            }

            return(limit);
        }
Esempio n. 2
0
        public static int GetLimit(this ICommandOptions options)
        {
            int limit = options.SafeGetOption(SetPagingOptionsExtensions.PageLimitKey, RepositoryConstants.DEFAULT_LIMIT);

            if (limit > RepositoryConstants.MAX_LIMIT)
            {
                return(RepositoryConstants.MAX_LIMIT);
            }

            return(limit);
        }
        public static bool HasSearchAfter(this ICommandOptions options)
        {
            var sorts = options.SafeGetOption <object[]>(SearchAfterQueryExtensions.SearchAfterKey);

            return(sorts != null && sorts.Length > 0);
        }
 public static bool ShouldReadCache(this ICommandOptions options)
 {
     return(options.SafeGetOption(SetCacheOptionsExtensions.ReadCacheEnabledKey, options.ShouldUseCache()));
 }
 public static TimeSpan GetExpiresIn(this ICommandOptions options)
 {
     return(options.SafeGetOption(SetCacheOptionsExtensions.CacheExpiresInKey, RepositoryConstants.DEFAULT_CACHE_EXPIRATION_TIMESPAN));
 }
Esempio n. 6
0
 public static int GetPage(this ICommandOptions options)
 {
     return(options.SafeGetOption(SetPagingOptionsExtensions.PageNumberKey, 1));
 }
Esempio n. 7
0
 public static bool ShouldNotify(this ICommandOptions options)
 {
     return(options.SafeGetOption(SetNotificationOptionsExtensions.NotificationsKey, true));
 }
 public static Microsoft.Extensions.Logging.LogLevel GetQueryLogLevel(this ICommandOptions options)
 {
     return(options.SafeGetOption(QueryLogOptionsExtensions.QueryLogLevelKey, options.SafeGetOption(QueryLogOptionsExtensions.DefaultQueryLogLevelKey, Microsoft.Extensions.Logging.LogLevel.Trace)));
 }
 public static AliasResolver GetRootAliasResolver(this ICommandOptions options)
 {
     return(options.SafeGetOption <AliasResolver>(RootAliasResolverKey));
 }
Esempio n. 10
0
 public static Type ParentDocumentType(this ICommandOptions options)
 {
     return(options.SafeGetOption <Type>(ParentDocumentTypeKey, typeof(object)));
 }
Esempio n. 11
0
 public static bool GetOriginalsEnabled(this ICommandOptions options, bool defaultEnabled = true)
 {
     return(options.SafeGetOption(OriginalOptionsExtensions.OriginalsEnabledKey, defaultEnabled));
 }
 public static SoftDeleteQueryMode GetSoftDeleteMode(this ICommandOptions options, SoftDeleteQueryMode defaultMode = SoftDeleteQueryMode.ActiveOnly)
 {
     return(options.SafeGetOption <SoftDeleteQueryMode>(SoftDeleteOptionsExtensions.SoftDeleteModeKey, defaultMode));
 }
 public static Consistency GetConsistency(this ICommandOptions options, Consistency defaultMode = Consistency.Eventual)
 {
     return(options.SafeGetOption(ConsistencyOptionsExtensions.ConsistencyModeKey, defaultMode));
 }
Esempio n. 14
0
 public static Action <IEnumerable <string> > GetUpdatedIdsCallback(this ICommandOptions options)
 {
     return(options.SafeGetOption <Action <IEnumerable <string> > >(UpdatedIdsCallbackOptionsExtensions.UpdatedIdsCallbackKey, null));
 }
 public static int GetMaxLimit(this ICommandOptions options)
 {
     return(options.SafeGetOption(SetPagingOptionsExtensions.MaxPageLimitKey, 10000));
 }
 public static object[] GetSearchAfter(this ICommandOptions options)
 {
     return(options.SafeGetOption <object[]>(SetElasticOptionsExtensions.SearchAfterKey));
 }
 public static ElasticTypeSettings GetElasticTypeSettings(this ICommandOptions options)
 {
     return(options.SafeGetOption <ElasticTypeSettings>(ElasticTypeSettingsKey));
 }
Esempio n. 18
0
 public static QueryFieldResolver GetQueryFieldResolver(this ICommandOptions options)
 {
     return(options.SafeGetOption <QueryFieldResolver>(QueryFieldResolverKey));
 }
 public static bool ShouldUseSnapshotPaging(this ICommandOptions options)
 {
     return(options.SafeGetOption <bool>(SetElasticOptionsExtensions.SnapshotPagingKey, false));
 }
Esempio n. 20
0
 public static IncludeResolver GetIncludeResolver(this ICommandOptions options)
 {
     return(options.SafeGetOption <IncludeResolver>(IncludeResolverKey));
 }
Esempio n. 21
0
 public static TimeSpan GetExpiresIn(this ICommandOptions options)
 {
     return(options.SafeGetOption(SetCacheOptionsExtensions.CacheExpiresInKey, options.SafeGetOption(SetCacheOptionsExtensions.DefaultCacheExpiresInKey, DefaultCacheExpiration)));
 }
Esempio n. 22
0
 public static IIndex GetElasticIndex(this ICommandOptions options)
 {
     return(options.SafeGetOption <IIndex>(ElasticIndexKey));
 }
Esempio n. 23
0
 public static bool SupportsSoftDeletes(this ICommandOptions options)
 {
     return(options.SafeGetOption <bool>(SupportsSoftDeletesKey));
 }
Esempio n. 24
0
 public static Type DocumentType(this ICommandOptions options)
 {
     return(options.SafeGetOption <Type>(DocumentTypeKey));
 }
 public static string GetDefaultCacheKey(this ICommandOptions options)
 {
     return(options.SafeGetOption <string>(SetCacheOptionsExtensions.CacheKeyKey, null));
 }
 public static string GetSnapshotScrollId(this ICommandOptions options)
 {
     return(options.SafeGetOption <string>(SetElasticOptionsExtensions.SnapshotPagingScrollIdKey, null));
 }
 public static bool ShouldUseCache(this ICommandOptions options, bool defaultValue = false)
 {
     return(options.SafeGetOption(SetCacheOptionsExtensions.CacheEnabledKey, defaultValue));
 }
 public static TimeSpan GetSnapshotLifetime(this ICommandOptions options)
 {
     return(options.SafeGetOption <TimeSpan>(SetElasticOptionsExtensions.SnapshotPagingLifetimeKey, TimeSpan.FromMinutes(1)));
 }
 public static string GetCacheKey(this ICommandOptions options, string defaultCacheKey = null)
 {
     return(options.SafeGetOption <string>(SetCacheOptionsExtensions.CacheKeyKey, defaultCacheKey ?? options.GetDefaultCacheKey()));
 }
 public static bool ShouldUseSearchAfterPaging(this ICommandOptions options)
 {
     return(options.SafeGetOption <bool>(SearchAfterQueryExtensions.SearchAfterPagingKey, false));
 }