Giter Club home page Giter Club logo

delve's Issues

Bug: X-Pagination nextPageLink

Hi Benjamin,

when I send request e.g. http://localhost:51607/api/user?filter=FirstName!=Veronica, I noticed that library is generating X-Pagination nextPageLink as http://localhost:51607/api/User?pageNumber=2&pageSize=5&filter=FirstName!%3Dveronica with %3D instead of = character.

It would be nice when characters would not be URL encoded (Percent Encoded).

Thanks,
Branislav

Question: CaseInsensitive NotEqual

Hi Benjamin,

thanks for awesome and useful library. It is exactly that I was looking for to implement in my REST APIs.

Do you have plan to implement CaseInsensitive NotEqual !=* operator?

Thanks,
Branislav

filters on json documents in SQL Server

I use SQL 2017 to store json documents and need to pass filters from API to apply on json properties. I also need projection to return only necessary properties and pagination. Does this library support querying on json documents or is there any modifications needed to make it work?

Issue: No service registered for QueryValidator

Hi Benjamin,

when I have class User without UserQueryValidator part like:

    public class User
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime DateOfBirth { get; set; }

        public IEnumerable<UserRole> UserRoles { get; set; }

        public User() { }

        public User(string firstName, string lastName, DateTime dateOfBirth)
        {
            FirstName = firstName;
            LastName = lastName;
            DateOfBirth = dateOfBirth;
        }
    }

and call http://localhost:{port}/api/user i get exception RuntimeException: No service registered for QueryValidator: Delve.Models.Validation.IQueryValidator`1[Delve.Demo.Models.User], but I don't want to have any query validation on User class in this case.

Question: ShapeData functionality

Hi Benjamin,

I figured out that ShapeData method "shapes" data after being retrieved from database with all columns (including columns data that we don't want). Do you plan to improve deffered query build with inlcuding select criteria before sending query to database.

Thanks,
Branislav

Question: Default sort property

Hi Benjamin,

what you think about adding method in AbstractQueryValidator to set certain property as default sort property if we don't want to sort results by primary key 'Id' by default:

public class UserQueryValidator : AbstractQueryValidator<User>
{
    public UserQueryValidator()
    {
        SetDefaultSortProperty("FirstName", x => x.FirstName, descending: true, order: 1);
        SetDefaultSortProperty("LastName", x => x.LastName, descending: false, order: 2);
    }
}

or to go with custom property attribute:

    public class User
    {
        public int Id { get; set; }

        [DefaultSortProperty(descending = true, order = 1)]
        public string FirstName { get; set; }

        [DefaultSortProperty(descending = false, order = 2)]
        public string LastName { get; set; }
        public DateTime DateOfBirth { get; set; }
    }

If we have two or more default order properties it will pick up first by lowest order number and sort result by that property.

Issue: ArgumentOutOfRangeException when default sort is not set

Hi Benjamin,

I want to report if AddDefaultSort method is not called in {SomeEntityName}QueryValidator class (default sorting is not set for this particular entity class) then exception of type ArgumentOutOfRangeException is thrown. E.g., for this code:

public class UserQueryValidator : AbstractQueryValidator<User>
{
        public UserQueryValidator()
        {
            //Adds virtual property as default sort
            //AddDefaultSort(u => u.LastName + " " + u.LastName, true);
        } 
}

exception is thrown in QueryConfiguration.cs file:

public IQueryable<T> ApplyDefaultSorts(IQueryable<T> source)
{
            if (source == null) { return null; }
            
            // on this line exception is thrown
            var orderedSort = _defaultSorts[0].ApplySort(source);

            for (int i = 1; i < _defaultSorts.Count; i++)
            {
                orderedSort = _defaultSorts[i].ApplySort(orderedSort);
            }
}

Issue: 'expand' query parameter exposes internal domain class names

Hi Benjamin,

when we send request like:

GET /api/Users
?filter=        Age>=20, Name$*Smith|Bullock
&orderby=       -Age, Name
&select=        Id, Name, Age
&expand=        UserRoles
&pageNumber=    1
&pageSize=      10

we expose our internal domain class name (navigation property) UserRoles to end users and I think it violates some of the REST API recommendation which suggests that we should hide our domain classes.

Accordingly, it would be good in CanExpand method that we could set string key like in other methods (CanSelect, CanFilter, CanOrder) which maps to our internal domain class like CanExpand("RolesOfUser", x => x.UserRoles) to hide our internal class name.

Thanks,
Branislav

Question: AddDefaultExpand method

Hi Benjamin,

have you thought about adding AddDefaultExpand method to QueryValidator where navigation property will be loaded by default because now is null. E.g. for class User:

public class User
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime DateOfBirth { get; set; }

    public IEnumerable<UserRole> UserRoles { get; set; }
}

UserRoles property is null, but with setting AddDefaultExpand(x => x.UserRoles) or AddDefaultExpand(x => x.UserRoles.Select(ur => ur.Role)), UserRoles property or UserRoles with Roles will be populated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.