Closed mgravell closed 1 week ago
questions:
1) what does it mean "[DbValue] allows the size and type to be conveyed into DbParameter" (I can see both of them have System.Data.DbType
member + DbParameter
can handle strings (which DbString
are))? Why is DbParameter
in the context here?
2) where is the code that copies entire files into the output?
.Foo
into the DB, we do that via a parameter; by default we can only guess as to the type and other properties - but sometimes the details matter, so this tribute allows the .Size
and .DbType
of the parameter object to be controlled more explicitly 2 do you mean this? https://github.com/DapperLib/DapperAOT/blob/main/src/Dapper.AOT.Analyzers/CodeAnalysis/Writers/InterceptorsLocationAttributeWriter.cs#L24
DbString
is a Dapper type that allows metadata to be conveyed for string types.However:
DbValue]
](https://github.com/DapperLib/DapperAOT/blob/main/src/Dapper.AOT/DbValueAttribute.cs)Suggestions:
[DbValue]
allows the size and type to be conveyed intoDbParameter
[DbValue]
insteadDbString
as a recognized type, and configure things correctlyDbString
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:DbString
is null, just setValue
toDbNull
AsValue
, or a(object)value.Value ?? DbNull
if easierThe 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