Vogen Help

Working with databases

Vogen has converters and serializers for databases, including:

They are controlled by the Conversions enum. The following specifies Newtonsoft.Json and System.Text.Json converters:

[ValueObject<float>(conversions: Conversions.NewtonsoftJson | Conversions.SystemTextJson)] public readonly partial struct Celsius { }

If you don't want any conversions, then specify Conversions.None.

If you want your own conversion, then again specify none, and implement them yourself, just like any other type. But be aware that even serializers will get the same compilation errors for new and default when trying to create value objects.

If you want to use Dapper, remember to register it—something like this:

SqlMapper.AddTypeHandler(new Customer.DapperTypeHandler());

See the examples folder for more information.

Last modified: 23 November 2024