DapperLib / DapperLib/Dapper

Do we plan to support the gerenate the SQL text per the Domain object?

Open
#1,771 0 comments 0 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

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:

  1. AddPrefixStrategy: add the prefix text to the table or column name
  2. AddSuffixStrategy: add the suffix text to the table or column name
  3. RemoveSuffixStrategy: remove the suffix text of the table or column name
  4. RemovePrefixStrategy: remove the prefix text of the table or column name
  5. ToUpperStrategy: upper the text of the table or column name
  6. ToLowerStrategy: lower the text of the table or column name
  7. ToCamelStrategy: camel the text of the table or column name
  8. WordBetweenUnderscoreStrategy: add underscope text of the between word for the table or column name
  9. CompositeStrategy: the composite for the above strategies.

The expected steps:
image

I saw the Dapper.Conrib provide some simple cases, do we have plan to include this feature in the future? Thanks.

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

Start by reviewing the described connection.Query() usage and the simple cases in Dapper.Contrib. Clarify whether the request is for automatic SQL generation, naming strategies, or both, and define the expected API and generated SQL before implementation. Done requires an agreed strategy model and concrete behavior for the listed naming transformations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.