Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Does not appear to work with QueryMultiple and .Read<> #43

@bjth

Description

@bjth

When using Dapper QueryMultiple, it appears the mapped columns are not working.

In my case QueryMultiple returns 3 tables.

var ds = con.QueryMultiple("uspSELNodes", p, commandType: CommandType.StoredProcedure);
var rows = ds.Read().ToDictionary(v => v.RowNo); //Returns a dynamic dictionary
var total = ds.Read<int>().First(); //Returns table 2 that contains just an int for a total
var columns = ds.Read<DynamicTable.Column>(); // Does not seem to map properly.

Class is as below :

 public class Column : IDynamicTableColumn
        {
            public string Prefix { get; set; }
            public string Name { get; set; }
            public string DisplayName { get; set; }
            public int Order { get; set; }
            public bool Orderable { get; set; }
            public bool Filterable { get; set; }
            public int Width { get; set; }
            public string ResourceName { get; set; }
        }

Mapping :

private class DynamicColumnMap : EntityMap<DynamicTable.Column>
        {
            public DynamicColumnMap()
            {
                Map(x => x.Prefix).ToColumn("column_prefix");
                Map(x => x.Name).ToColumn("column_name");
                Map(x => x.Order).ToColumn("display_order");
                Map(x => x.Orderable).ToColumn("can_be_ordered");
                Map(x => x.Filterable).ToColumn("can_be_filtered");
                Map(x => x.Width).ToColumn("column_width_in_pixels");                
            }
        }

Config :

FluentMapper.Initialize(config =>
            {
                config.AddMap(new DynamicColumnMap());
                config.AddConvention<LowerCaseConvention>        ().ForEntitiesInAssembly(typeof(Configuration).Assembly);
            });

The columns that match name for name for example DisplayName all get their correct values from Dapper, the mapped columns appear to be getting the defaults for their type, strings empty, bools false and ints 0.

Am I initializing this correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions