Introduction and configuration of Petapoco and introduction configuration of Petapoco

Source: Internet
Author: User
Tags custom name

Introduction and configuration of Petapoco and introduction configuration of Petapoco

 

I. Basic Introduction

After the birth of a product, publicity is essential. I first came to know Petapoco. I patiently read the English introduction on the official website, because I found that the author is a young man of literature and art, he didn't publicize his products very high, but many places reveal a little low-key, humble breath, fresh, cute. It can be seen in many places, such as in the Background section: So, what's with the name? Well if Massive is massive, this is "Peta" massive (it's now over 1,500 lines after all) and since it works with "Poco" s... "PetaPoco" seemed like a fun name !! Also, in the title, I abandoned the old style and wrote Features at a Glance, but it was not silent.

Peta we already know what it means, that is, Gigabit. So what is poco? See its website subtitle "A tiny ORM-ish thing for your POCOs". Next time, we will briefly introduce the concept of ORM.

Ii. configuration process

(1) download an NuGet. Tools. vsix file from the official Petapoco website and install it.

(2) Open Visual Studio2012, create a project, create a console program and a form program, and start the NugGet package in solution.

[Supplement] Nuget is an open-source project under the. NET platform and is an extension of Visual Studio. When using Visual Studio to develop applications based on. NET Framework, Nuget can add, remove, and update references in projects more quickly and conveniently. Nuget is a member of ASP. NET Gallery. NuGet is a free and open-source package management and development tool. It focuses on combining third-party Component Libraries in the. NET application development process. To share the development tools or libraries, you need to create an Nuget package and place the package to the Nuget site. If you want to use a tool or library developed by someone else, you only need to obtain the package from the site and install it in your own Visual Studio project or solution. NuGet can more easily add some dll and files (such as jquery) to the project without copying from the file.

(3) Search for Petapoco in the search box and install it.

(4) Create an app. config file in Models for configuration. Add the connectionStrings tag. Add attributes. The source code is as follows:

1 <connectionStrings>2 3 <add name="DefaultConnection" 
connectionString="Data Source=PC***********\MSSQLSERVER2008R;Initial Catalog=ZJSTGYL; Persist Security Info=True;
         User ID=*********; Password=*********;"
providerName="System.Data.SqlClient" />5 </connectionStrings>

(5) the code in this section is used to connect the program to the database. connectionStrings is the keyword. Data Source = computer name and Database Name (IP Address can also be used for computer name output ), enter the database account and password, and providerName to get or set. the name of the NET Framework data provider. The Persist Security Info attribute indicates whether to save Security information. In fact, it can be simply understood as "whether to save password information after the database connection is successful ", "True" indicates that the data is saved. "False" indicates that the SqlDataSource control is not saved and used to connect to the basic data source. In short, it is the database driver.

[Supplement] The Connection Methods for each database vary. For details, refer to the connection methods provided by www.connectionstrings.com. The website provides the connection methods for all the databases in the world.

(6) Open Database. tt in the Models folder and fill in relevant properties. ConnectionStringName = "DefaultConnection"; Namespace = "This can be customized here. The custom name will be the Namespace name of the instantiated Database "; classPrefix = "whether or not this attribute is set does not affect the running of the program, but will be changed to a prefix in the future database instantiation ".

[Supplement] The. tt file here refers to the T4 Template. T4 (Text Template Transformation Toolkit) is the code generation engine officially used by Microsoft in Visual Studio 2008. In Visual Studio, "T4 Text Template" is a hybrid template composed of some text blocks and control logic. It can generate text files. In Visual C # Or Visual Basic, the control logic is written as a piece of program code. The generated file can be any type of text, such as web pages, resource files, or program source code in any language. To put it bluntly, a T4 Text Template is a code generator for custom rules. Based on the business model, you can generate any form of text files or strings for program calls.

(7) Save all and open the Class View. If the class of your custom namespace is displayed, the database connection is basically successful. If the prefix is changed before, open the namespace and the prefix will be marked.

(8) You can use the SQL language to perform database operations.


What kind of mobile phone configuration is good? Could you introduce me to the configuration?

Which one is cheap? (joke )~ The key to G7 is that the Android system is 'more promising than Nokia's SB, and more use' means that your mobile phone features are more comprehensive! That is to say, N97 is not the real machine master. There are more than 2 K
 
How to introduce the mobile phone configuration to the customer

Depending on the customer's needs, let's introduce the mobile phone configuration and see what type of mobile phone people want.
 

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.