Open MeltyObserver opened 1 day ago
Try changing the property to DateOnly
with DateOnly
dapper crashes on insert
code:
cn.Execute("INSERT INTO files (title, creationDate) VALUES ($title, $date)",
new { title = file.Title, date = file.CreationDate });
error:
Unhandled exception. System.NotSupportedException: The member date of type System.DateOnly cannot be used as a parameter value
at Dapper.SqlMapper.LookupDbType(Type type, String name, Boolean demand, ITypeHandler& handler) in /_/Dapper/SqlMapper.cs:line 497
at Dapper.SqlMapper.CreateParamInfoGenerator(Identity identity, Boolean checkForDuplicates, Boolean removeUnused, IList`1 literals) in /_/Dapper/SqlMapper.cs:line 2656
at Dapper.SqlMapper.GetCacheInfo(Identity identity, Object exampleParameters, Boolean addToCache) in /_/Dapper/SqlMapper.cs:line 1848
at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 654
at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 527
at Program.<Main>$(String[] args) in Program.cs:line 26
That does work, I thought the issue was from this library because i didn't have an issue with postgres (npgsql)
is it possible to add this to the library?
When trying to query a row with a Date column using dapper i get
Object must implement IConvertible
but it works fine with ADO.NetFull exception:
I wrote an example project that can reproduce the bug https://github.com/MeltyObserver/DDB.NET.Examples