續(xù)四,休息天翻得很少,不過總算在keep doing,:-)
4 framework特別指導
framework specific guidelines
4.1 數(shù)據(jù)訪問
data access
1. 總是使用類型安全的數(shù)據(jù)集或者數(shù)據(jù)表。避免使用原始的ado.net。
always use type-safe data sets or data tables . avoid raw ado.net.
2. 訪問數(shù)據(jù)庫時總是使用事務(wù)。
always use transactions when accessing a database.
a) 總是使用服務(wù)組件事務(wù)。
always use enterprise services transactions.
b) 不要使用ado.net事務(wù)。
do not use ado.net transactions.
3. 總是將事務(wù)隔離級別設(shè)置為序列的。
always use transaction isolation level set to serializable.
a) 使用其它隔離級別需要管理層決定。
requires management decision to use anything else.
4. 不要使用服務(wù)器瀏覽器將數(shù)據(jù)庫連接拖到windows表單、asp.net表單或web服務(wù)中。這樣做耦合了界面層和數(shù)據(jù)層。
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的組件以調(diào)用該組件客戶端不同的身份運行。
run components accessing sql server under separate identity from that of the calling client.
7. 總是在高層用類型安全的類包裝存儲過程。僅在那個類中調(diào)用存儲過程。
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.
待續(xù)。忽然想到曾閱讀過一篇關(guān)于business layer的文章,總體是責問有多少程序真正有business layer,文中甚至倡議presentation layer中不要引用system.data命名空間,你做得到嗎?小雞射手還不行,嘻嘻...
新聞熱點
疑難解答
圖片精選