For some more type safety I wanted to introduce a PageId type in my application. However, I am not totally sure what the best option to do so is.
I want the IDs to be GUIDs, so I thought I just create a PageId class which inherits from the Guid class. Unfortunately the Guid is a struct, which does not support inheritance. I think that would have been the nicest solution, because it would be a value type and easy to map using ORMs, but it seems that this solution is of the table.
Now my question is how should it look instead? I can think of a few options:
- Build a
PageIdstruct that contains aGuidproperty (I guess that can be hard to use in code at times) - The same as 1., but using a
classinstead of astruct - Using the new
recordtype
Or is there another obvious option I am overlook?
Guidproperty, but that's also the case for the other options. If I could inherit fromGuiddirectly that step would not be necessary.