Skip to content

Commit

Permalink
Update package version and documentation content
Browse files Browse the repository at this point in the history
The Installation instruction now uses a variable for the package version, improving the ease of maintenance when new releases are made. Detailed information on shared types in the package has been added, and the 'Working-with-Guids' document has been renamed to 'Working-with-IDs'. Other minor text updates have also been applied throughout the documentation.
  • Loading branch information
SteveDunn committed Jul 17, 2024
1 parent fc580aa commit 335abc8
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 34 deletions.
2 changes: 1 addition & 1 deletion docs/site/Writerside/hi.tree
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<toc-element topic="Serialization.md"/>
<toc-element topic="Using-with-JSON.md"/>
<toc-element topic="Working-with-logging-frameworks.md"/>
<toc-element topic="Working-with-Guids.md"/>
<toc-element topic="Working-with-IDs.md"/>
<toc-element topic="Working-with-databases.md"/>
</toc-element>
<toc-element topic="how-to-guides.topic">
Expand Down
4 changes: 2 additions & 2 deletions docs/site/Writerside/topics/discussions/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void IncreaseQuantity(
int customerId, int supplierId, int quantity)
```

... and a caller calls it like this:
and a caller calls it like this:

```C#
_service.IncreaseQuantity(_supplierId, _customerId, _quantity)
Expand All @@ -92,5 +92,5 @@ the same ID for customer and supplier.

With Value Objects representing `SupplierId`, `CustomerId`, and `Quantity`, the compiler **can** tell us
if we mess up the order. These types make the domain code more understandable (more domain language and less C#
types), and validation is as close to the data as possible; in this example, it likely means that all of these
types), and validation is as close to the data as possible; in this example, it likely means that all these
types cannot be zero or negative.
30 changes: 0 additions & 30 deletions docs/site/Writerside/topics/how-to/Installation.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/site/Writerside/topics/reference/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public partial struct CustomerId;
var newCustomerId = CustomerId.FromNewGuid();
```

> To customize the generation of Guids, please see [this tutorial](Working-with-Guids.md)
> To customize the generation of Guids, please see [this tutorial](Working-with-IDs.md)
>
### Can I use value objects instead of primitives as parameters in Blazor pages and components?
Expand Down
50 changes: 50 additions & 0 deletions docs/site/Writerside/topics/tutorials/Installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Installing Vogen

<note>
These tutorials assume a working knowledge of .NET and C#, so won't include the basics necessary to start the
tutorials, e.g. things like creating new projects, creating new types, compiling, viewing error output, etc.
</note>

<tabs>
<tab title=".NET CLI">
<code xml:lang="bash">dotnet add package Vogen --version %latest_version%</code>
</tab>
<tab title="Package Manger">
<code xml:lang="bash">NuGet\Install-Package Vogen -Version %latest_version%</code>
</tab>
<tab title="Package Reference">
<code-block>
<![CDATA[
<PackageReference Include="Vogen" Version="%latest_version%" />
]]>
</code-block>
</tab>
</tabs>

<note>
Change `%latest_version%` for the <a href="https://www.nuget.org/packages/Vogen">latest version listed on NuGet</a>
</note>

When added to your project, the **source generator** generates the wrappers for your primitives and the **code analyzer**
will let you know if you try to create invalid Value Objects.

Vogen consists of two dlls:

1. `Vogen.dll` - this is the source generator and analyzers and is not needed at runtime
2. `Vogen.SharedTypes.dll` - this contains the types that **are** referenced at runtime, e.g. `ValueObjectValidationException` and `ValueObjectOrError` which is used by the `TryFrom` method.

Unlike using some other source generators, specifying `PrivateAssets="all" ExcludeAssets="runtime"` with Vogen will cause exceptions at runtime because of missing types.

`Vogen.SharedTypes.dll` is about 18KB, so will add little to your application's size.
It is referenced on its own.
Here is a snippet from a `deps.json` file with it specified:

```xml
"Vogen/4.0.14": {
"runtime": {
"lib/net8.0/Vogen.SharedTypes.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "%latest_version%"
}
}
```
7 changes: 7 additions & 0 deletions docs/site/Writerside/v.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vars>
<var name="latest_version"
instance="hi"
value="4.0.14"
type="string"
/>
</vars>

0 comments on commit 335abc8

Please sign in to comment.