FluentGraphQL 1.0.2
dotnet add package FluentGraphQL --version 1.0.2
NuGet\Install-Package FluentGraphQL -Version 1.0.2
<PackageReference Include="FluentGraphQL" Version="1.0.2" />
<PackageVersion Include="FluentGraphQL" Version="1.0.2" />
<PackageReference Include="FluentGraphQL" />
paket add FluentGraphQL --version 1.0.2
#r "nuget: FluentGraphQL, 1.0.2"
#:package FluentGraphQL@1.0.2
#addin nuget:?package=FluentGraphQL&version=1.0.2
#tool nuget:?package=FluentGraphQL&version=1.0.2
FluentGraphQL
FluentGraphQL is a lightweight, fluent C# library for dynamically building GraphQL queries. It allows developers to construct queries using a clean, chainable syntax—perfect for strongly typed scenarios or custom query generation needs.
✨ Features
- ✅ Fluent API to build queries and mutations
- ✅ Nested field selection with arguments and aliases
- ✅ Inline fragments and directives support (coming soon)
- ✅ Easy integration in .NET applications
- ✅ Lightweight and dependency-free (except System.Text.Json)
- ✅ Built-in performance benchmarks — see results
🤝 Comparison
There is already a great alternative available: graphql-query-builder-dotnet
by Charles Devandiere. This project is not meant to discredit or replace it.
FluentGraphQL simply explores a different architectural approach, with a focus on fluent chaining, dynamic nested field construction, and performance fine-tuning. It was born independently and out of curiosity and learning, not competition.
📦 Installation
You can install via NuGet (once published):
dotnet add package FluentGraphQL
🚀 Quick Start
public class Account
{
public Guid Id { get; set; }
public string SocietyName { get; set; }
public Adresse Adresse { get; set; }
public IEnumerable<Contact> Contacts { get; set; }
}
public class Contact
{
public Guid Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public IEnumerable<Task> Tasks { get; set; }
}
public class Task
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime StartDate { get; set; }
public DateTime? DueDate { get; set; }
}
var builder = new FluentGraphQL();
var name = "Paul";
var cities = new string[] { "Paris", "London", "Madrid", "New York" };
builder
.AddVariable("firstName", GraphQLParameterType.STRING, name)
.AddVariable("cities", GraphQLParameterType.STRING_ARRAY, cities)
.AddQuery(new GraphQLQueryObject<Account>("accounts")
.AddEveryFields()
.AddCollectionField(
account => account.Contacts,
contact => contact
.AddEveryFields()
.AddCollectionField(
c => c.Tasks,
task => task.AddEveryFields()
)
)
.WithArguments(new
{
where = new
{
and = new object[]
{
new
{
city = new
{
@in = "cities"
}
},
new
{
contacts = new
{
firstName = new
{
eq = "firstName"
}
}
}
}
}
}));
var result = yourapi.Query(builder.Request);
Resulting query:
query ($firstName: String!, $cities: [String]!) {
accounts(
where: {
and: [
{ city: { in: $cities } }
{ contacts: { firstName: { eq: $firstName } } }
]
}
) {
id
societyName
contacts {
id
firstName
lastName
email
phoneNumber
tasks {
id
name
description
startDate
endDate
}
}
}
}
🧪 Testing
Tests are written with xUnit and cover query generation scenarios. To run:
dotnet test
📄 License
MIT — see the LICENSE file for details.
🙌 Contribution
Feel free to open issues or submit pull requests to improve the library!
FluentGraphQL is maintained by @Nayruuu.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- System.Text.Json (>= 9.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.2 | 118 | 7/30/2025 |