Skip to content

ZOXEXIVO/GraphQL.QueryBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL.QueryBuilder

GraphQL.QueryBuilder is simple utility for creating strong typed GraphQL queries for .NET objects in EntityFramework Include-style.

At current state work only on simple queries.

Code

static void Main(string[] args)
{
    string queryName = "queryName";
    
    var renderedQuery = GraphQuery.Query<User>(queryName, user => user.FirstName == "FIRSTNAME")
        .Include(x => x.Friends).ThenInclude(x => x.Department)
        .Include(x => x.FirstName)
        .Include(x => x.Department.Id)
        .Include(x => x.Department.Name)
        .Include(x => x.Friends).ThenInclude(x => x.Department.Parent.Id)
        .Include(x => x.Friends).ThenInclude(x => x.Department.Parent.Name)
        .Include(x => x.Friends).ThenInclude(x => x.Department.Parent.Parent)
        .Render();

        Console.WriteLine(renderedQuery);
}

Result

query {
    queryName (firstName : ""FIRSTNAME"") {
         friends {
             department {
                 parent {
                    id,
                    name,
                    parent
                 }
             }
         },
         firstName,
         department {
            id,
            name
         }
     }
 }

License

Apache Version 2.0

About

Strong typed GrapgQL query builder with EF-like syntax

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages