entity framework - REST interface to include referenced entities - .NET 4.5, MVC + EF -


let's have 2 entities: 1. order 2. package

each package has foreign key order, ie. 1 order has 1 or more packages. created rest interface able retrieve orders in json format.

    public ienumerable<order> get()     {         using (dbcontext db = new dbcontext())         {             return db.order.tolist();         }     } 

i wondering if there elegant way of including children packages in above json response, packages each order?

thanks


Comments

Popular posts from this blog

html - jquery - p element wont show after I hid it -

python - BeautifulSoup: How to get the nearest tag -

php - Return Last Insert ID with PDO -