DapperLib / DapperLib/DapperAOT

How to use with multimapper

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

Nobody has claimed this yet.

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

Description

I have the following command:

var unitGrouping = new Dictionary<string, ValueTuple<HashSet<IndoorRecord>, HashSet<OutdoorRecord>>>();

_ = await mySqlConnection.QueryAsync<IndoorRecord, OutdoorRecord, bool>(@"
        select BIN_TO_UUID(iu.id) as id, iu.model, iu.serial, iu.name, iu.type, iu.interface_mac, iu.interface_serial, iu.interface_model, BIN_TO_UUID(iu.system_id) as system_id, 
        BIN_TO_UUID(ou.id) as id, ou.model, ou.serial, BIN_TO_UUID(ou.system_id) as system_id                    
        from building b 
        inner join indoor_unit iu on b.id = iu.building_id 
        left join outdoor_unit ou ON iu.system_id = ou.system_id 
        where b.id = UUID_TO_BIN(@buildingId)",
    (iu, ou) =>
    {
        if (!unitGrouping.ContainsKey(iu.SystemId))
            unitGrouping.Add(iu.SystemId, ([], []));

        unitGrouping[iu.SystemId].Item1.Add(iu);

        if (ou != null)
            unitGrouping[iu.SystemId].Item2.Add(ou);

        return true;
    },
    new { buildingId });

This generates the expected message DAP001 as the method is on SqlMapper which isn't supported yet.

But, is there a way of changing the code so I can use the multimapper like above with AOT, or is this just something not possible at this time? I saw in a different issue that suggested to not use the extension method but that didn't seem to make any difference.

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

The example uses SqlMapper.QueryAsync with multimapping and reports DAP001 because SqlMapper is unsupported for AOT. Start by examining the AOT support for SqlMapper and the DAP001 diagnostic, then determine whether a supported entry point exists for this case. Done means establishing a supported approach or clearly defining the required AOT support.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, mysql
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.