Dapper
Dapper copied to clipboard
Do we plan to support the gerenate the SQL text per the Domain object?
Sometimes the sql string is very simple, but wast time. For example:
public class Customer
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
We have the model and match to a datatable, if we can use the way to get the result that will be awesome.
connection.Query<Customer>();
The SQL text can be gerenated by some strategies.
SELECT
id AS Id,
first_name AS FirstName,
last_name AS LastName
FROM
tbl_customer
We can defined many different strategies to covner the Domain object to our expected string:
- AddPrefixStrategy: add the prefix text to the table or column name
- AddSuffixStrategy: add the suffix text to the table or column name
- RemoveSuffixStrategy: remove the suffix text of the table or column name
- RemovePrefixStrategy: remove the prefix text of the table or column name
- ToUpperStrategy: upper the text of the table or column name
- ToLowerStrategy: lower the text of the table or column name
- ToCamelStrategy: camel the text of the table or column name
- WordBetweenUnderscoreStrategy: add underscope text of the between word for the table or column name
- CompositeStrategy: the composite for the above strategies.
The expected steps:
I saw the Dapper.Conrib provide some simple cases, do we have plan to include this feature in the future? Thanks.