My Products
Help
AndreasDevDotNet
CONTRIBUTOR ***

Business NXT C# Client library

by AndreasDevDotNet

Hi, we have written a c# client library that we will use in our integrations with the Business NXT API.

 

This client let's you use LINQ to create the graph QL queries.

At the moment it supports:

* Queries

* Mutations

* Aggregates

* Reports

* Batch queries/mutations

 

Code example:

 

 

var orderDateFilter = new DateOnly(2022, 1, 1);
var statusList = new List<int?> { 1,2,3 };
var exRt = 50.000M;
var query = vbNxtClient.UseCompanyQueryFor<Order>(4816282)
                .Select(s => new { s.OrderNo, s.OrderDateAsDate, s.OrderPreferencesFlags })
                .Where(x => x.OrderDateAsDate >= orderDateFilter && x.Group3.In(statusList) && x.ExchangeRate > exRt)
                .CreateQuery();

var queryResult = await query.ExecuteQuery<OrderResult>();

 

 

This will create the following GraphQL

 

 

query
{
    useCompany(no: 4816282)
    {
        queryResult : order
        (
            filter: {_and :[{exchangeRate :{_gt:50.000}},{orderDateAsDate :{_gte:"2022-01-01"}},{group3 :{_in:[1,2,3]}}]}
        )
        {
            totalCount
            pageInfo
            {
                hasNextPage
                hasPreviousPage
                startCursor
                endCursor
            }
            items
            {
                orderNo
                orderDateAsDate
                orderPreferencesFlags

            }
        }
    }  
}

 

 

 

Right now this client library is something we have developed to use with our integrations but I just wanted to check if this is something that could be intresting for others.

 

If you have any questions feel free to ask.

 

/Andreas (Pector AB)

2 REPLIES 2
AndreasDevDotNet
CONTRIBUTOR ***

by AndreasDevDotNet

Right now this client is something we use inhouse and it lacks documentation, I just wanted to check if there are any other people intrested.
The only reason why we built this was that I could not find any other Linq providers for GraphQL that worked well, also I had a lot of free time this summer 🙂 

by Marius Bancila

So you built a LINQ provider for BNXT GraphQL. I think this is a very interesting project, although I don't know how many people would want to use it. But if you are willing to share it, then why not just put it on github, document it a bit more, and we can tell about it to customers so they can try it.