DragonFruit.Data.Roslyn
4.1.1
dotnet add package DragonFruit.Data.Roslyn --version 4.1.1
NuGet\Install-Package DragonFruit.Data.Roslyn -Version 4.1.1
<PackageReference Include="DragonFruit.Data.Roslyn" Version="4.1.1" />
paket add DragonFruit.Data.Roslyn --version 4.1.1
#r "nuget: DragonFruit.Data.Roslyn, 4.1.1"
// Install DragonFruit.Data.Roslyn as a Cake Addin #addin nuget:?package=DragonFruit.Data.Roslyn&version=4.1.1 // Install DragonFruit.Data.Roslyn as a Cake Tool #tool nuget:?package=DragonFruit.Data.Roslyn&version=4.1.1
DragonFruit.Data.Roslyn
A Roslyn source-generator and code-analyzer for DragonFruit.Data
Overview
DragonFruit.Data.Roslyn is a source-generator and code-analyzer for DragonFruit.Data that allows the request-building logic for ApiRequest
classes to be generated at compile-time, rather than at runtime for each request.
It also provides code-analysis to ensure attributes are applied correctly and design rules are followed.
Some aspects of the source generator are based on ChilliCream's StrawberryShake code generation tooling (MIT Licensed)
Usage/Getting Started
Note: while semantic versioning is used, it is best to ensure the versions of DragonFruit.Data
and DragonFruit.Data.Roslyn
are the same.
The easiest way to get started is to install the NuGet package alongside DragonFruit.Data
and start writing ApiRequest
classes.
The analyzer will inform you of any issues through your IDE.
Because the source generator writes code that is written at compile time, additional constraints are applied to ApiRequest
classes:
- Classes must be marked with the
partial
keyword - Classes must not be nested within another class
- Members cannot be marked as
private
orinternal
(onlypublic
andprotected
andinternal protected
are allowed)
Additionally, if a library uses the source generator, it must be added to all consumers unless all requests are sealed
.
This is due to how the source generator works in combination with how DragonFruit.Data prioritises source-generated request builders.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
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 |
---|---|---|
4.1.1 | 77 | 9/27/2024 |
4.1.0-beta | 87 | 8/9/2024 |
4.0.0 | 475 | 12/19/2023 |
0.9.3-beta | 168 | 12/17/2023 |