Dapper.AOT works by generating code to handle your types; to do that, those types need to be accessible to the generated code; that means they must have
at least internal accessibility.
Since Dapper.AOT is adding code to your assembly, this problem is limited to nested types that are private, protected, private protected, or similar -
basically anywhere where any other part of your code couldn’t mention the type by name.
Suggestions:
- make the type
internal:private=>internalprotected=>protected internal
- disable Dapper.AOT (
[DapperAot(false)])
Can Dapper.AOT not just generate the code inside the relevant types via
partialtypes?
No; generators are limited to placing their output in pre-defined namespaces, which precludes generating code directly inside your types. We may be able to revisit this at a later date by having you add additional configuration to your project file, allowing Dapper.AOT to generate inside your namespaces.