andrewlock / StronglyTypedId

A Rosyln-powered generator for strongly-typed IDs
MIT License
1.52k stars 79 forks source link

Prevent empty values #143

Closed Palpie closed 3 weeks ago

Palpie commented 1 month ago

I would like an option to prevent empty values. With the option you would not have the Empty field and trying to create a new instance with an empty value would result in an ArgumentException being thrown.

andrewlock commented 3 weeks ago

You can kind of do this by creating your own template, as described in this post and this issue 🙂

One problem you will have is that you can still always create an instance of the type with the default keyword.