-
Notifications
You must be signed in to change notification settings - Fork 81
Description
The npgsql docs briefly mention that you can map CLR classes to composite types in Postgres. But since no example class is given, it is not clear how the mapping works (i.e. what scenarios can or can't be handled). For example, looking at the CompositeHandler.cs code seems to indicate npgsql can map classes with or without explicit constructors...is that correct?
Generally, it would be useful to document the following mapping issues:
- What happens if the CLR class has a member that is not in the Postgres type (and vice versa)?
- Can we mark some CLR class members as excluded so they don't partake in the mapping?
- Must the CLR type be a class or are structs also supported? The code hints that structs are supported.
- If constructors with parameters are allowed, is there a limit on number of parameters? The code hints at 8 parameters max.
I imagine, automatic mapping between CLR classes and Postgres composite types is a huge selling point for many people. I personally would love to know what is or isn't possible so I can take full advantage of this feature. I would also like to know if it is possible to extend/customize the npgsql type handler facility for composite types so I can make up my own rules for mapping.
PS: Postgres is truly amazing and having npgsql so us .NET folks can use Postgres is really cool. My thanks to all who contribute! 🙏