DapperLib / DapperLib/DapperAOT

Type mapper enhancements

Open
#176 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
472
Forks
43
Avg merge
1d 4h
Merged PRs (30d)
18

Description

In Dapper the SqlMapper is a static entity which maps types to db columns. There are a couple of use cases which are problematic to handle with the normal Dapper mapping mechanism.

When considering new APIs for DapperAOT it would be great if there could be a mechanism to support these use cases.

Mapping Validation

In a large application it is useful to validate that mappings are correct and complete. This type of validation typically can be excluded for production versions but is useful for test and development.

Validation type 1: All db columns have properties

In original Dapper a custom converter can be used which throws an exception when a db column is encountered for which there is no property. This caters for this type of validation.

Validation type 2: All properties have db columns

This is not possible to do with the current dapper. The reason for this is that the mapper is fully static so it is not possible to store any context specific data for a specific conversion. If the sqlmapper were not static (i.e. if we had something like the DapperPlus Context then it would have been possible to do.

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 with the SqlMapper entry point and the DapperAOT API discussion described in the issue. Review how custom converters handle unmapped database columns and how static mapping limits validation context. Done would require an agreed mechanism covering both validation types, including properties without database columns.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.