private async Task OnBeforeQueryAsync(IRepositoryQuery query, ICommandOptions options, Type resultType)
        {
            if (SupportsSoftDeletes && IsCacheEnabled && options.GetSoftDeleteMode() == SoftDeleteQueryMode.ActiveOnly)
            {
                var deletedIds = await Cache.GetListAsync <string>("deleted").AnyContext();

                if (deletedIds.HasValue)
                {
                    query.ExcludedId(deletedIds.Value);
                }
            }

            var systemFilter = query.GetSystemFilter();

            if (systemFilter != null)
            {
                query.MergeFrom(systemFilter.GetQuery());
            }

            if (BeforeQuery == null || !BeforeQuery.HasHandlers)
            {
                return;
            }

            await BeforeQuery.InvokeAsync(this, new BeforeQueryEventArgs <T>(query, options, this, resultType)).AnyContext();
        }
        private async Task OnBeforeQueryAsync(IRepositoryQuery query, ICommandOptions options, Type resultType)
        {
            if (SupportsSoftDeletes && IsCacheEnabled)
            {
                var deletedIds = await Cache.GetSetAsync <string>("deleted").AnyContext();

                if (deletedIds.HasValue)
                {
                    query.ExcludedId(deletedIds.Value);
                }
            }

            if (BeforeQuery == null)
            {
                return;
            }

            await BeforeQuery.InvokeAsync(this, new BeforeQueryEventArgs <T>(query, options, this, resultType)).AnyContext();
        }