advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the Code for this Article
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 1.7/5 | Rate this item | 3 users have rated this item.
 

ADO.NET vNext Part 3: Querying with LINQ

LINQ provides a straightforward yet expressive SQL-like syntax with which you can query an Entity Data Model and uses anonymous types to return strongly-typed results. 


advertisement
he previous article in this series introduced the core concepts of Object Services Layer, including the steps to perform CRUD (Create, Read, Update and Delete) operations against the Entity Data Model (EDM). With that foundation, this installment focuses on using LINQ to query the EDM. Specifically, this article focuses on the expressive query capabilities of LINQ in querying the EDM through the object services layer. By using LINQ on top of the EDM, you can perform operations such as sorting, joining multiple tables, projecting result sets and so on.


 
Figure 1. Using LINQ on top of ADO.NET Object Services Layer: The figure shows the role of the LINQ framework in the overall architecture of ADO.NET vNext.
Figure 1 shows how client applications can work with the object services layer either through LINQ or Entity SQL.


Using LINQ vs. Entity SQL
If you are using the map provider to connect to the database, the only way you can execute queries is through Entity SQL. However when using the object services layer, you can use either Entity SQL or LINQ to work with the object services layer as shown in Figure 1. So when should you use LINQ as opposed to Entity SQL? The answer depends on your requirements. For example, if you need to construct and execute queries dynamically, Entity SQL will fit the bill. Otherwise, LINQ might be a better choice because its strongly typed nature provides you with compile-time checking and Intelliesense. Note that LINQ and Entity SQL are not mutually exclusive and you can seamlessly mix-and-match LINQ and Entity SQL with no restrictions.

What You Need
To follow along with this article series, you need:


  Next Page: Retrieving Data using LINQ


Page 1: IntroductionPage 3: Using Anonymous Types to Retrieve Data
Page 2: Retrieving Data using LINQ 
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs