In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "Linq how to use data tables", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "Linq how to use data tables" this article.
First of all, let you learn about the data tables used by Linq, and then give a comprehensive introduction to the generated SQL statements.
Using datasheets, Linq can automatically create entity classes based on views by dragging views from Server Explorer / Database Explorer to the Ogamard R designer. We can manipulate the view in the same way as we do with data tables. Note here: the Omax R designer is a simple object-relational mapper because it only supports 1:1 mapping relationships. In other words, there can only be 1:1 mapping between an entity class and a database table or view. Complex mapping is not supported (for example, mapping an entity class to multiple tables). However, you can map an entity class to a view that joins multiple related tables. Let's write two examples using the Invoices and Quarterly Orders views included in the NORTHWND database as examples.
We use the following code to query ShipCity's invoice in London.
Var Q = from i in db.Invoices where i.ShipCity = = "London" select new {i.OrderID, i.ProductName, i.Quantity, i.CustomerName}
Here, the generated SQL statement is similar to the Linq usage data table:
SELECT [t0]. [OrderID]. [ProductName], [t0]. [Quantity], [t0]. [CustomerName] FROM [dbo]. [Invoices] AS [t0] WHERE [t0]. [ShipCity] = @ p0-- @ p0: Input NVarChar (Size = 6; Prec = 0; Scale = 0) [London]
The following example finds out the orders for each quarter.
Var Q = from qo in db.Quarterly_Orders select qo
Generate the SQL statement as follows:
SELECT [t0]. [CustomerID]. [CompanyName], [t0]. [City], [t0]. [Country] FROM [dbo]. [Quarterly Orders] AS [t0] above are all the contents of the article "how to use data sheets in Linq". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.