How to get Dapper to ignore/remove underscores in field names when mapping?

前端 未结 2 533
离开以前
离开以前 2021-02-02 08:51

There are many ways to map database field names to class names, but what is the simplest way to just remove the underscores?

    public IEnumerable

        
相关标签:
2条回答
  • 2021-02-02 09:21
    Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true;
    

    job done ;p

    0 讨论(0)
  • 2021-02-02 09:33

    The readme doesn't show any support for renaming columns. You could alias them in select:

    select person_id as personid, full_name as fullname from fn_get_person();
    

    as suggested in this answer.

    0 讨论(0)
提交回复
热议问题