Mapping a date field to a string property of record
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
I am trying to migrate all my classes to record because it is much more convenient and during that I found a case which works fine on class type but not record:
Structure of record:
public record Foo(string EffectiveDate);
OR
public record Foo() {
public string EffectiveDate { get; set; }
}
Structure of class
public class Foo {
public string EffectiveDate { get; set; }
}
My MSSQL table is using Date data type for EffectiveDate, when I tried to query by using dapper then it throws an exception said it can't match the record which doesn't happened when using class.
Is there a workaround to get through? Thanks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported difference between the shown C# record and class when mapping the MSSQL Date field EffectiveDate with Dapper. Compare the mapping behavior and determine whether the record maps successfully or whether a documented workaround is needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100