IDesign C # Coding Specification (v)

Source: Internet
Author: User
Tags requires web services
Code | Four, the rest day turned very little, but finally in keep doing,:-)

4 Special guidance of the framework
Framework Specific Guidelines
4.1 Data access
Data Access
1. Always use a type-safe dataset or datasheet. Avoid using the original ado.net.
Always use Type-safe data sets or data tables. Avoid raw ado.net.
2. Transactions are always used when accessing the database.
Always use transactions when accessing a database.
A The service component transaction is always used.
Always use Enterprise Services transactions.
(b) Do not use ado.net transactions.
Don't use ado.net transactions.
3. Always set the transaction isolation level to a sequence.
Always use transaction ISOLATION level set to Serializable.
A The use of other isolation levels requires management decisions.
Requires management decision to use anything else.
4. Do not use the server browser to drag a database connection to a Windows Form, ASP. NET form or Web service. This is done by coupling the interface layer with the data layer.
Do don't use the Server Explorer to drop connections on Windows Forms, ASP.net forms or Web services. Doing so couples the presentation tier to the data tier.
5. Avoid using SQL Server validation.
Avoid SQL Server authentication.
A) Instead, use Windows validation.
Use Windows authentication instead.
6. The component that will access SQL Server runs with different identities of the component client.
Run components accessing SQL Server under separate identity from that of the calling client.
7. Always wrap stored procedures with type-safe classes at the top level. Call a stored procedure only in that class.
Always wrap your stored procedures in a, type safe class. Only that class invokes the stored procedures.
8. Avoid putting any logic in the stored procedure.
Avoid putting any logic inside a stored procedure.
A if there is an if in the stored procedure, you may have made a mistake.
If there is an if inside a stored procedure, for you are doing something.

Cond. Suddenly thought had read an article about business layer, the overall is to blame how many programs really have business layer, the text even the initiative presentation layer don't reference System.Data namespace, you can do? Chicken shooter still not good, hee ...


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.