-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed as not planned
Labels
Description
I have a simple view in my DB that is exposing some fields joined from multiple tables.
I'm able to map my view to my object similar to below:
public IQueryable<MyDbView> MyDbView => Query<MyDbView>();
modelBuilder.Query<MyDbView>().ToView(nameof(MyDbView));
MyDbView is an object similar to below.
public class MyDbView
{
public string Name { get; set; }
public Address OriginAddress { get; set; }
public Address DestinationAddress { get; set; }
}
public class Address
{
public int Id { get; set; }
public string Name { get; set; }
public string City { get; set; }
public string State { get; set; }
}
Since the view has flattened the 2 Address fields into 6 fields (OriginAddressName, OriginAddressCity, etc.), I'd like to inflate them back to the object so MyDbView doesn't have to have a direct mapping to each of the fields and I can reuse my types.
How is the possible?
Reactions are currently unavailable