DapperLib / DapperLib/Dapper

Oracle Timestamp with Time Zone not being mapped to DateTimeOffset properly

Open
#1,039 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:mapping db:oracle
Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

I have a created date column with type of Timestamp with Time Zone in oracle. My C# model property type is a DateTimeOffset. It sets the value, but it loses the offset portion.

I tried writing my own custom type handler, but the object value that gets passed to the parse method is already a DateTime object, and has already lost the offset value of the data at that point.

The issue is reader => handler.Parse(type, reader.GetValue(startBound));

reader.GetValue(startBound) returns a DateTime at that point.

We need to be able to change it to reader.GetDateTimeOffset() or have some sort of lower level extension point.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the mapping expression reader => handler.Parse(type, reader.GetValue(startBound)) and trace how the Oracle timestamp value reaches the type handler. Verify whether GetDateTimeOffset() or a lower-level extension point can preserve the offset, then confirm that a C# DateTimeOffset property receives it correctly. No test file or implementation path is named in the issue, so locate the relevant mapping tests before defining completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.