IDesign C#编码规范(五)

4 Framework特别指导
Framework Specific Guidelines
4.1 数据访问
Data Access
1. 总是使用类型安全的数据集或者数据表。避免使用原始的ADO.NET。
Always use type-safe data sets or data tables . Avoid raw ADO.NET.
2. 访问数据库时总是使用事务。
Always use transactions when accessing a database.
a) 总是使用服务组件事务。
Always use Enterprise Services transactions.
b) 不要使用ADO.NET事务。
Do not use ADO.NET transactions.
3. 总是将事务隔离级别设置为序列的。
Always use transaction isolation level set to Serializable.
a) 使用其它隔离级别需要管理层决定。
Requires management decision to use anything else.
4. 不要使用服务器浏览器将数据库连接拖到Windows表单、ASP.NET表单或Web服务中。这样做耦合了界面层和数据层。
Do not 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. 避免使用SQL Server验证。
Avoid SQL Server authentication.
a) 而是使用Windows验证。
Use Windows authentication instead.
6. 将访问SQL Server的组件以调用该组件客户端不同的身份运行。
Run components accessing SQL Server under separate identity from that of the calling client.
7. 总是在高层用类型安全的类包装存储过程。仅在那个类中调用存储过程。
Always wrap your stored procedures in a high level, type safe class. Only that class invokes the stored procedures.
8. 避免在存储过程中放任何逻辑。
Avoid putting any logic inside a stored procedure.
a) 如果存储过程中有IF,你可能犯了错误。
If there is an IF inside a stored procedure, you are doing something wrong.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值