c# - get sub table record in entity framework 5 code first without using "Include" -


i application had use entity framework 5 code first want sub table data without using "include" like

public class category {   public int id {get; set;}   public string name {get; set;}   public virtual icollection<product> products{get;set;}  }   public class product  {   public int id {get;set}   public string name{get;set;}   public virtual category {get;set;} } 

i need both way it's there solution that

i think, getting collection without include getting collection without join in sql:)

sure, can

var category = context.categories.first(c=>c.id == id); category.products = context.products.where(p=>p.categoryid == id); 

but lead 2 db connections. include translated join statement common solution retrieving related data.

in not poco entities objectcontext tracking can use loadwith statement. include, too


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -