-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e4a909
commit 4a0b5b1
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
Source/SourceGenerators/Blazorise.ApiDocsGenerator/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ApiDocsGenerator | ||
|
||
> Under construction | ||
Things I don't want to miss documenting: | ||
|
||
- how to run/test the source generator (sg) | ||
- dotnet bulild vs launchSettings | ||
- file watch to run dotnet build | ||
- The emitted output (inside the proj that reference the sg under Dependencies -> .NET -> Source Generators) | ||
- On exceptions, it removes the files, no logs. All dies. (haven't explored fully yet) | ||
- PrivateAssets="all" (will not be part of nuget package) | ||
- Why logging is difficult, custom logging | ||
- What it can do.. | ||
|
||
|
||
|
||
how to debug it | ||
|
||
```json | ||
{ | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"profiles": { | ||
"Generators": { | ||
"commandName": "DebugRoslynComponent", | ||
"targetProject": "../../Blazorise/Blazorise.csproj" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Default Values | ||
|
||
The source generator (SG) is designed to pick up almost any default value. | ||
|
||
```csharp | ||
[Parameter] public string SomeValue { get; set; } = "some string value"; | ||
``` | ||
|
||
It also handles cases where the default value is not a constant. | ||
|
||
```csharp | ||
[Parameter] public TimeSpan Interval { get; set; } = TimeSpan.FromSeconds(10); | ||
``` | ||
|
||
Additionally, it works when the default value is set by a backing field. | ||
|
||
```csharp | ||
private string _backingField = "backed value"; | ||
[Parameter] public string BackedValue | ||
{ | ||
get => _backingField; | ||
set => _backingField = value; | ||
} | ||
``` | ||
|
||
Moreover, it preserves the exact expression of default values, not just the computed result. | ||
|
||
```csharp | ||
[Parameter] public int ComplexValue { get; set; } = 20 * 200; // Output: "20 * 200", not "4000" | ||
``` | ||
|