15 days of learning about MVC (sharing experiences and ideas)

Source: Internet
Author: User
Tags microsoft website

Learning MVC has been half a month, looking at the calendar, just half a month. I've shared a few of the most practiced blogs:
One, "Creating the first MVC application" http://www.cnblogs.com/insus/p/3358560.html
Second, what is the namespace of the @Styles http://www.cnblogs.com/insus/p/3358703.html
Third, the MVC application uses the entity Framework http://www.cnblogs.com/insus/p/3359111.html
Four, "MVC bundle (dressing) CSS or js file" http://www.cnblogs.com/insus/p/3360918.html
Five, the DataTable data is shown in the MVC application http://www.cnblogs.com/insus/p/3361182.html
VI, "MVC uses non-Entity Framework to display data in view" http://www.cnblogs.com/insus/p/3364235.html
Seven, "MVC uses non-Entity Framework to display data in view (ii)" http://www.cnblogs.com/insus/p/3364482.html
Eight, "MVC shows detailed records without Entity Framework" http://www.cnblogs.com/insus/p/3366608.html
Nine, "MVC adds data and stores it in the database" http://www.cnblogs.com/insus/p/3367244.html
Ten, "MVC implementation Delete database records" http://www.cnblogs.com/insus/p/3368042.html
11, "MVC Implementation Update database Data" http://www.cnblogs.com/insus/p/3369609.html

Introduction, Insus.net according to their own level of learning comprehension, but also can only write some introductory exercises to enhance their confidence or the most important.

Look at the official Microsoft website of the English version of the article, need to prepare translation software, in the installation of visual Stuidio and practice.

Listen to Microsoft's official push to save the video, do not understand it does not matter, or to read the entire video operation steps.

Reading, is a good way to learn Chinese translation of the book, read it again.  Learn about the difference between ASP and MVC, and learn the principles and changes of MVC from differences and comparisons. It is also possible to learn that some of the design patterns of the C # language can also be applied to MVC, which allows insus.net to use an object that was previously written to access data in ASP.

To learn more, try creating an MVC application that starts with an empty MVC app and is best to create another internet. The practice of course is in an empty application, so the start is quite difficult, but when you go back and look at it for some time, progress is conceivable. Why also create an Internet non-empty MVC application, is to learn online tutorials, video practice, this is trivial, the most important is to practice when you encounter problems, you can quickly find a method in it.

For example, in the second article in the above list of posts, the problem with a namespace is that, from the comparison of two applications, it is known that its namespace is under System.Web.Optimization. There is also the third article, in the establishment of empty applications, the idea to use DbContext, also encountered in the object and namespace the same problem, and finally by contrast to find a solution. After watching the net text, listen to the video, and then practice, encounter problems, you will think, how can others, their own in progress, is met this, meet the problem, through contrast, know that they write more, write less what. Must be able to learn more knowledge.

When practicing to the fourth, know that in an MVC application, it is not necessary to After exposure to MVC, you learn another kind of razor @helper syntax.

Insus.net after learning MVC, the first idea was that the database data was displayed on the Web page. In the fifth chapter, an attempt has been made to apply the components of the previous ASP. In the controller, the data of the database is returned to a DataTable and passed into view (). In this exercise, it can be said that it takes a lot of time, because it requires razor grammar. After referencing @model System.Data.DataTable, you can use @foreach to cycle through the DataTable. Oh, if it is in ASP, Insus.net will directly use the Repeater control, easy to implement, but now is the age of MVC, of course, with the country into the vulgar.

In this half-month study, the most seen is the entity Framework. Its powerful features bring us a lot of simplicity and efficiency. But for Insus.net, it's not necessary to spend more time studying it. Use a feeling that seems to be a bit tied. But it's just a temporary idea. So the sixth seventh in the column of the above blog is generated. Instead of using the Entity Framework to interact with the database, it is now a bit more and less touching to see your thoughts and actions.

The next few exercises will also not use the entity Framework. Insus.net shows a series of MVC blogs that show the details of a record, add data to the data, update and delete data.
When writing this summary, found a small problem, such as the eighth it is to display a record, but Insus.net is @model ienumerable<fruitcategory>. So insus.net refactor and correct it here, modifying the controller:



Comment out the original action, rewrite the other one (refer to 2). Then go to modify the details.cshtml view, in four steps to modify:



The tenth deletion function is also the same, do not need to record @foreach in the delete.cshtml view, now insus.net modification and refactoring as follows, first, the Heart controllers:


Then modify the delete.cshtml view:


Finally Insus.net want to say, because MVC for insus.net is still unfamiliar, only in continuous learning, practice, can have progress. In addition, many hope that netizens more guidance, thanks.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.