DapperLib / DapperLib/Dapper

Guid convert to String issue

Open
#1,096 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi everyone,
i try used Dapper in my project, but i found a basic problem when i try use Dapper convert Guid type in Sqlserver to C# string type, it prompt to me

Error parsing column 0 (ID=6c2adb93-d81a-4fda-8e25-c6e90d4ebaaa - Object)

now i have to write a typehandler for myself and its only converted string type by ToString()

public class StringGuidHandler:SqlMapper.TypeHandler<string>
   {
       public override void SetValue(IDbDataParameter parameter, string value)
       {
           parameter.Value = value;
       }

       public override string Parse(object value)
       {
           return value.ToString();
       }
   }

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

No source file or test is named in the issue. Start by reproducing the SQL Server Guid-to-C# string mapping and trace Dapper's column conversion path, comparing it with the custom StringGuidHandler shown. Done means the mapping succeeds without a user-defined handler and has a regression test for the reported value.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.