Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with multimapper #114

Open
ADringer opened this issue Mar 11, 2024 · 0 comments
Open

How to use with multimapper #114

ADringer opened this issue Mar 11, 2024 · 0 comments

Comments

@ADringer
Copy link

ADringer commented Mar 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant