Asp.net MVC + MongoDB + autofac to build a lightweight Blog system (2)

Source: Internet
Author: User

The first is to paste my vs2010 skin to everyone. Many people want to use this skin .. I will not send emails to you one by one.

Http://files.cnblogs.com/n-pei/Exported-2011-03-31.zip

 

SeriesArticleIndex:

Asp.net MVC + MongoDB + autofac to build a lightweight Blog system (1)

Asp.net MVC + MongoDB + autofac to build a lightweight Blog system (2)

Repository pattern and MongoDB are described in previous articles. Some Garden friends asked how to run MongoDB in Windows service mode. The official MongoDB website has explained how to implement it, here I will briefly describe the installation process (I uninstalled and installed it again for you to write a tutorial ).

 

Note that if you are win7, you need to run it as an administrator... Enter cmd.exe in the Start-> search box to find the file, right-click it, and you will see running as an administrator:

 

In the DOS window, enter the folder where the MongoDB bin is located:

 

Enter the installation command. The log file path and database path must be provided in the format.

Next, Use Net start "MongoDB" to start the service ..

 

MongoDB is now OK. Next we will use the ORM tool to operate MongoDB. I chose very small simple data. Compared with other ORM tools, it must be used in. Net 4.0. Someone in the previous article asked why it was easy to use the ORM tool to perform data operations more easily. In addition, it is easier to Use ORM to associate tables.

 

As shown in, I have added a simple data operation MongoDB project to override the postrepositoryCodeAnd compare the following code:

1. Rewrite the Save method:

2. getbyid method:

 

 

 

Modify other methods and finally run. Everything is normal...

 

Related Article

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.