querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

Mapping query result to Property of certain type

Open Mardallas opened this issue 3 years ago • 2 comments

Hello,

I am trying to see if it is possible to map results to an Property which is an object.

public class Location
{
    public Guid LocationId { get; set; }
    public Address Address { get; set; }

}
public class Address
{
    public string Address1 { get; set; }
    public string Address2 { get; set; }
    public string Suite { get; set; }
    public int City { get; set; }
    public string State { get; set; }
    public string PostalCode { get; set; }
    public string Country { get; set; }
}

and provided that the all columns for address are returned back in the query result.

How can I get the Location object populated with address information .

Thank you,

Mar

Mardallas avatar Jan 14 '21 22:01 Mardallas

if someone can help me put a label "help wanted". I am not able to find how to.

Mardallas avatar Jan 14 '21 22:01 Mardallas

No it's not supported natively, the best way to achieve this is by returning flat objects, then mapping into your custom classes

ahmad-moussawi avatar Jan 16 '21 08:01 ahmad-moussawi