Skip to content

How to convert dynamic list to strong type object list #160

@theinternetgy

Description

@theinternetgy

Hi
I am developing one application using dapper dot net, need to get collection of objects where columns are configurable, when i tried ienumerable dynamic list, i am getting list of Key Value Pair of records
But i need list of records with columns (as we get in strong type ienumerable collection)

I tried below code:

IEnumerable tickets = null;
using (var dbcon = new DBContext())
{
tickets = dbcon.Connection.Query(" Select top 100 Ticket_ID,Ticket_No,Status,Reg_Time from IM_TicketMaster where sup_Function=@instance", new { Instance = new DbString { Value = "IT" } });
}
the result is IEnumerable collection of DapperRow, when i convert this collection to json, it gives me a collection of key value pair, how do i convert this dynamic list to strong type collection.

Is there any proper way to get List of dynamic json objects instead of key value collection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions