DapperAOT
DapperAOT copied to clipboard
DbString - analyzer and runtime
DbString
is a Dapper type that allows metadata to be conveyed for string types.
However:
- it is allocatey
- it isn't touched by AOT today
- what it achieves is the same as
DbValue]
Suggestions:
- we need to verify that
[DbValue]
allows the size and type to be conveyed intoDbParameter
- we should emit a warning to use
[DbValue]
instead - we should probably treat
DbString
as a recognized type, and configure things correctly - for this last, I would propose (if any
DbString
are encountered) writing a helper method into the output (we have some prior art that copies entire files into the output; that would be fine) with a method that takes aDbParameter
andDbString
(global::
qualified) and does the right things:
- if the entire
DbString
is null, just setValue
toDbNull
- set the size if appropriate
- set the type if appropriate
- set the value using
AsValue
, or a(object)value.Value ?? DbNull
if easier
The reason we can't put this into the library is that we can't ref Dapper directly because of the Dapper/Dapper.StrongName duality - hence we need to implement it in codegen