Open lemonmojo opened 12 months ago
So the reason is that under the cover it's actually a generic Nullable<T>
: https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1?view=net-7.0
Example of what such a parameter looks like:
Same applies to primitives btw. ie. int?
/Nullable<int>
.
Partial Strategy: Add an extension method to System.Type
: bool IsNullableValueType(this Type type, out Type? valueType)
so that we can figure out if the targeted type is a nullable value type and if it is, get the underlying type as an out parameter.
As a first step, this information can be used to emit a more detailed unsupported type reason message.
See https://learn.microsoft.com/en-us/dotnet/api/system.nullable.getunderlyingtype?view=net-7.0
I think that once a TypeDescriptor is created for such a type, we can add conversions there which will then be used by later generation phases.
https://github.com/royalapplications/beyondnet/commit/fc54eecb55c8052e82d5f41b5a372d2530fc04b7 added support for nullable structs (no support yet for nullable primitives and enums).
ie.
bool TryGetId(out Guid? id)
I think that's currently an unsupported scenario. Have to check.