You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a SQLite database with a table that has a column defined as the following: CreatedDate DateTime DEFAULT (date('now')),
While using Dapper Execute command, I can insert a new record just fine with with or without CreatedDate
BUT if I try to use Dapper Query either with a class or dynamic it will throw an error saying the following:
String was not recognized as a valid DateTime.
So I then proceeded to create a new SqlMapper.TypeHandler<DateTime?> like the following: #295
I added Dapper.SqlMapper.AddTypeHandler(new NullableDateTimeHandler.Default);
But the NullableDateTimeHandler SetValue and Parse never get called.
I then went into SQLite I changed the CreatedDate to a DateTimeOffet CreatedDate DateTimeOffest DEFAULT (date('now')),
Which is not a know SQLite data type.
And then change the TypeHandler<DateTimeOffset?>...
Then it works.
So for some reason I can't get SqlMapper.TypeHandler<DateTime?> to work with SQLite but I can get it to work with custom types "aka DateTimeOffset?".
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
I have a SQLite database with a table that has a column defined as the following:
CreatedDate DateTime DEFAULT (date('now')),
While using Dapper Execute command, I can insert a new record just fine with with or without CreatedDate
BUT if I try to use Dapper Query either with a class or dynamic it will throw an error saying the following:
So I then proceeded to create a new SqlMapper.TypeHandler<DateTime?> like the following:
#295
I added
Dapper.SqlMapper.AddTypeHandler(new NullableDateTimeHandler.Default);
But the NullableDateTimeHandler SetValue and Parse never get called.
I then went into SQLite I changed the CreatedDate to a DateTimeOffet
CreatedDate DateTimeOffest DEFAULT (date('now')),
Which is not a know SQLite data type.
And then change the TypeHandler<DateTimeOffset?>...
Then it works.
So for some reason I can't get SqlMapper.TypeHandler<DateTime?> to work with SQLite but I can get it to work with custom types "aka DateTimeOffset?".
What am I doing wrong?
The text was updated successfully, but these errors were encountered: