StrawberryShake.Extensions.DynamicVariables
1.0.0
dotnet add package StrawberryShake.Extensions.DynamicVariables --version 1.0.0
NuGet\Install-Package StrawberryShake.Extensions.DynamicVariables -Version 1.0.0
<PackageReference Include="StrawberryShake.Extensions.DynamicVariables" Version="1.0.0" />
<PackageVersion Include="StrawberryShake.Extensions.DynamicVariables" Version="1.0.0" />
<PackageReference Include="StrawberryShake.Extensions.DynamicVariables" />
paket add StrawberryShake.Extensions.DynamicVariables --version 1.0.0
#r "nuget: StrawberryShake.Extensions.DynamicVariables, 1.0.0"
#:package StrawberryShake.Extensions.DynamicVariables@1.0.0
#addin nuget:?package=StrawberryShake.Extensions.DynamicVariables&version=1.0.0
#tool nuget:?package=StrawberryShake.Extensions.DynamicVariables&version=1.0.0
StrawberryShake.Extensions.DynamicVariables
A C# source generator that adds ExecuteDynamicAsync to StrawberryShake operations - use anonymous types while preserving property order and keeping full type safety on results.
Installation
dotnet add package StrawberryShake.Extensions.DynamicVariables
No configuration needed. The generator automatically extends all your mutations and queries.
Usage
var result = await client.CreateOrder.ExecuteDynamicAsync(new
{
cid = companyId,
orders = new[]
{
new
{
customerNo = 10000,
orderLines = new[] { new { productNo = "1000", quantity = 2 } }
}
}
});
// Return type is fully typed: IOperationResult<ICreateOrderResult>
var orderNo = result.Data?.UseCompany?.Order_create?.Items?[0].OrderNo;
Why?
StrawberryShake generates strongly-typed input classes, but:
- Property order isn't preserved - C# dictionaries don't maintain insertion order, breaking APIs that expect specific field ordering
- Schema changes require regeneration - adding optional fields means regenerating all client code
This generator solves both problems by serializing your variables with System.Text.Json, which preserves property declaration order.
Features
- Zero configuration - install and it works
- Property order preserved - JSON fields appear in declaration order
- Type-safe results - full IntelliSense on response types
- Flexible inputs - anonymous types, records, classes, or
JsonObject - No reflection - compile-time generation using partial classes
Compatibility
- .NET 6, 8, 10+
- StrawberryShake 15.x
License
MIT
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- StrawberryShake.Server (>= 15.1.11)
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 |
|---|
v1.0.0: Initial release. Adds ExecuteDynamicAsync to all StrawberryShake operations with property order preservation.