public static ISortConventionDescriptor UseMock(
     this ISortConventionDescriptor descriptor)
 {
     return(descriptor.AddDefaults().Provider(
                new QueryableSortProvider(x => x
                                          .AddDefaultFieldHandlers()
                                          .AddOperationHandler <MatchAnyQueryableOperationHandler>()
                                          .AddFieldHandler <MatchAnyQueryableFieldHandler>())));
 }
    public static ISortConventionDescriptor AddDefaultOperations(
        this ISortConventionDescriptor descriptor)
    {
        if (descriptor is null)
        {
            throw new ArgumentNullException(nameof(descriptor));
        }

        descriptor.Operation(DefaultSortOperations.Ascending).Name("ASC");
        descriptor.Operation(DefaultSortOperations.Descending).Name("DESC");
        return(descriptor);
    }
Example #3
0
        /// <summary>
        /// Binds common runtime types to the according <see cref="SortInputType"/> that are
        /// supported by Neo4J
        /// </summary>
        /// <param name="descriptor">The descriptor where the handlers are registered</param>
        /// <returns>The descriptor that was passed in as a parameter</returns>
        /// <exception cref="ArgumentNullException">
        /// Throws in case the argument <paramref name="descriptor"/> is null
        /// </exception>
        public static ISortConventionDescriptor BindDefaultNeo4JTypes(
            this ISortConventionDescriptor descriptor)
        {
            if (descriptor is null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            descriptor.BindRuntimeType <string, DefaultSortEnumType>();
            descriptor.DefaultBinding <DefaultSortEnumType>();

            return(descriptor);
        }
        public static ISortConventionDescriptor BindDefaultTypes(
            this ISortConventionDescriptor descriptor)
        {
            if (descriptor is null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            // bind string as it is a class to avoid SortType<string>
            descriptor.BindRuntimeType <string, DefaultSortEnumType>();
            descriptor.DefaultBinding <DefaultSortEnumType>();

            return(descriptor);
        }
Example #5
0
 protected virtual void Configure(ISortConventionDescriptor descriptor)
 {
 }
Example #6
0
 protected override void Configure(ISortConventionDescriptor descriptor)
 {
     descriptor.Operation(DefaultSortOperations.Ascending).Name("ASC");
 }
Example #7
0
 /// <summary>
 /// Initializes the default configuration for Neo4J on the convention by adding operations
 /// </summary>
 /// <param name="descriptor">The descriptor where the handlers are registered</param>
 /// <returns>The <paramref name="descriptor"/></returns>
 public static ISortConventionDescriptor AddNeo4JDefaults(
     this ISortConventionDescriptor descriptor) =>
 descriptor.AddDefaultNeo4JOperations().BindDefaultNeo4JTypes().UseNeo4JProvider();
Example #8
0
 /// <summary>
 /// Adds a <see cref="Neo4JSortProvider"/> with default configuration
 /// </summary>
 /// <param name="descriptor">The descriptor where the provider is registered</param>
 /// <returns>The <paramref name="descriptor"/> that was passed in as a parameter</returns>
 public static ISortConventionDescriptor UseNeo4JProvider(
     this ISortConventionDescriptor descriptor) =>
 descriptor.Provider(new Neo4JSortProvider(x => x.AddDefaultFieldHandlers()));
 public static ISortConventionDescriptor UseQueryableProvider(
     this ISortConventionDescriptor descriptor) =>
 descriptor.Provider(new QueryableSortProvider(x => x.AddDefaultFieldHandlers()));
 protected override void Configure(ISortConventionDescriptor descriptor)
 {
     descriptor.AddDefaults();
     descriptor.Operation(DefaultSortOperations.Ascending).Name("Different");
 }
 public static ISortConventionDescriptor AddDefaults(
     this ISortConventionDescriptor descriptor) =>
 descriptor.AddDefaultOperations().BindDefaultTypes().UseQueryableProvider();
Example #12
0
 /// <summary>
 /// Initializes the default configuration for MongoDb on the convention by adding operations
 /// </summary>
 /// <param name="descriptor">The descriptor where the handlers are registered</param>
 /// <returns>The <paramref name="descriptor"/></returns>
 public static ISortConventionDescriptor AddMongoDbDefaults(
     this ISortConventionDescriptor descriptor) =>
 descriptor.AddDefaultMongoDbOperations().BindDefaultMongoDbTypes().UseMongoDbProvider();