So I need to select a Task()
object, with it's Attachments()
objects, with Include()
, like this:
var tmp = cntx.Tasks.Include( at => at.Attachments ).FirstOrDefault(t => t.Id == id );
It's working fine, MVC api controller can serialize it to a json, with all of it's Attachmnets listed, basically it's working wonderfully.
Now my problem is, that i need 3 additional string property (for clearer example, I only use +1 string below) in the Task()
public class TaskView : DataClasses.Task {
public string BusinessName { get; set; }
}
And those props are not navigational properties for Task()
, in fact it's from a few other tables. Now I can join up the previous query, with the tables, but I'm not sure how to select the previous fully populated Task object, with all of it's navigational Attachment()
objects, and cast it to TaskView obj, with the added BusinessName string.
Any thoughts?