Home > other >  ASP.NET MVC queries
ASP.NET MVC queries

Time:10-03


~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Development tools and key technology: VS layui bootstrap
Author:
k.Time to write: 2019/5/4
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
As the growth of the knowledge, we would be more contact, one of the most extensive is the MVC, it not only involves the DW before we come into contact with the knowledge, such as CSS 3, HTML, javascript, and some front-end framework, such as layui, bootstrap etc... We want to bring here is an important part of the MVC, it involves the data in the database, query, yes it is

This is our commonly used a query, and list<> It SelectVo is a list of our own encapsulates an entity such as below:

This method is generally applicable to the novice, it is easier to let everyone remember the structure of the code, then want to speak two kinds of query is our teacher gave us a means of saving the amount of code, and also is an easy way to

As you can see, the second is linq query method, it is equivalent to the first one is simple, and its role is to use the var, relatively so again in the form of "variables", is the premise under the condition of don't know, it will automatically find the related, and then matching,

The third way that is more simple, it adopted the practice of "parameters", in the figure as a parameter, it is arbitrary by personal hobby, in these three query, people also think the third good, simple, clear, is also recommended the third, can effectively save the amount of code, let oneself more clean and tidy, the framework of
The above query is for the page rendering, so as to arouse the data of database and query, and the following query is about conditions, (code from flexion teacher)


In fact, this kind of condition query with little more than wipe don't, it's just one more condition, this is our single condition query, query, naturally there will be many conditions as follows:

Many conditions query compared with single query conditions but with a little more involved conditions, involves a little more, other are not changed, now the query condition compared with the previous three, the latter is the former "before falling," so fundamental to play good,

CodePudding user response:

Elder brother, cow force 6666666
  • Related