Skip to content

Commit 40632c7

Browse files
committed
r
1 parent aacb195 commit 40632c7

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

ReadMe.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ For `params T[]`, all subsequent arguments become the values of the array. For e
485485

486486
If none of the above cases apply, `JsonSerializer.Deserialize<T>` is used to perform binding as JSON. However, `CancellationToken` and `ConsoleAppContext` are treated as special types and excluded from binding. Also, parameters with the `[FromServices]` attribute are not subject to binding.
487487

488+
If you want to change the deserialization options, you can set `JsonSerializerOptions` to `ConsoleApp.JsonSerializerOptions`.
489+
488490
### Custom Value Converter
489491

490492
To perform custom binding to existing types that do not support `ISpanParsable<T>`, you can create and set up a custom parser. For example, if you want to pass `System.Numerics.Vector3` as a comma-separated string like `1.3,4.12,5.947` and parse it, you can create an `Attribute` with `AttributeTargets.Parameter` that implements `IArgumentParser<T>`'s `static bool TryParse(ReadOnlySpan<char> s, out Vector3 result)` as follows:
@@ -757,15 +759,18 @@ app.Run(args);
757759

758760
### Sharing Filters Between Projects
759761

760-
`ConsoleAppFilter` is defined as `internal` for each project by the Source Generator, so the filters to be implemented must also be `internal`. Sharing at the csproj or DLL level is not possible, so source code needs to be shared by linking references.
762+
`ConsoleAppFilter` is defined as `internal` for each project by the Source Generator. Therefore, an additional library is provided for referencing common filter definitions across projects.
761763

762-
```xml
763-
<ItemGroup>
764-
<Compile Include="..\CommonProject\Filters.cs" />
765-
</ItemGroup>
766-
```
764+
> PM> Install-Package [ConsoleAppFramework.Abstractions](https://www.nuget.org/packages/ConsoleAppFramework.Abstractions)
765+
766+
This library includes the following classes:
767+
768+
* `IArgumentParser<T>`
769+
* `ConsoleAppContext`
770+
* `ConsoleAppFilter`
771+
* `ConsoleAppFilterAttribute<T>`
767772

768-
If you want to share via NuGet, you need to distribute the source code or distribute it in a format that includes the source code using `.props`.
773+
Internally, when referencing `ConsoleAppFramework.Abstractions`, the `USE_EXTERNAL_CONSOLEAPP_ABSTRACTIONS` compilation symbol is added. This disables the above classes generated by the Source Generator, and prioritizes using the classes within the library.
769774

770775
### Performance of filter
771776

0 commit comments

Comments
 (0)