DapperLib / Dapper.Contrib

Dapper community contributions - additional extensions for Dapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add the mapping strategy to support the table name and column name

jack-gaojz opened this issue · comments

In the real scenario, we should create the datatable with the different name conventions. For example: tbl_customer (table name), id(column name), first_name(column name). But the domain object should follow the C# name convention, for example

public class Customer
{
        public int Id { get; set; }
        public string FirstName { get; set; }
}

We can define a interface IMappingStrategy then implement different strategies:
image

We can define the global strategy or set the strategy for the speicifed domain object event the property. We will generate the SQL with the defined strategies. That will be wonderful feature.

Thanks.