Home > Net >  C # linq
C # linq

Time:09-26

When writing linq, recently took data from two databases use linq connect grouping statistics, there are difference set and set of data set, in the end to use linq extension methods count () to obtain element quantity, efficiency is a little low, you have any other simple and useful method to get the quantity

CodePudding user response:

Database linq provider is not linq for object, the difference is that the database is the purpose of the encapsulation of the SQL database, on the one hand, most database linq provider is "lazy loading" (Lazy Type), so attention should be paid to test queries don't repeat above (2 times) send queries to SQL statements to the database, on the other hand, you don't have a lot of irrelevant data query and serialization to read to get your local client for the so-called "connection, grouping, statistics", because it tends to make queries slow hundreds, in this algorithm, may indicate your server architecture design ability is not strong, not a real business logic processing system and c - s architecture is only a c - s relational database driver), or is your this project would not have been suitable for the traditional relational database to process (for example, some people easily calculated using relational database SQL to handle business logic, only full database statements), the really big data and high concurrent systems, are basically traditional relational databases are not applicable, this need to use the high-speed cache memory, calculation engine, and so on design framework, if a man with only a relational database, then basically should find some traditional OA, and some application of the traditional, modern society's big data applications should be handed over to someone else to do,

CodePudding user response:

If there is no requirement of real-time, can use a temporary table, statistics regularly

CodePudding user response:

What do you mean by "use linq extension methods count () to obtain amount" may be I said above "in the first case, you may repeat many times to send SQL query to database system, this can make a count operation program for at least one times slower speed,
  •  Tags:  
  • C#
  • Related