We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi cannot convert datetime to another type.
public class PersianDateTimeHandler : SqlMapper.TypeHandler<PersianDateTime> { public static readonly PersianDateTimeHandler Default = new PersianDateTimeHandler(); public override void SetValue(IDbDataParameter parameter, PersianDateTime value) { parameter.Value = value.ToDateTime(); } public override PersianDateTime Parse(object value) { return ((DateTime)value).ToPD(); } } SqlMapper.AddTypeHandler(PersianDateTimeHandler.Default); SqlMapper.AddTypeMap(typeof(PersianDateTime), DbType.DateTime); SqlMapper.AddTypeMap(typeof(PersianDateTime?), DbType.DateTime); SqlMapper.AddTypeMap(typeof(PersianDateTime), DbType.DateTime2); SqlMapper.AddTypeMap(typeof(PersianDateTime?), DbType.DateTime2); SqlMapper.AddTypeMap(typeof(PersianDateTime), DbType.DateTimeOffset); SqlMapper.AddTypeMap(typeof(PersianDateTime?), DbType.DateTimeOffset);
The text was updated successfully, but these errors were encountered:
This sounds more like a question to Dapper developers?
Sorry, something went wrong.
in your driver does not work .
in other driver like postgres work correctly.
No branches or pull requests
Hi
cannot convert datetime to another type.
The text was updated successfully, but these errors were encountered: