![微軟企業(yè)庫3.x概述_第1頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/12/fc3edbad-f013-4551-8fcb-a04d579a7f4f/fc3edbad-f013-4551-8fcb-a04d579a7f4f1.gif)
![微軟企業(yè)庫3.x概述_第2頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/12/fc3edbad-f013-4551-8fcb-a04d579a7f4f/fc3edbad-f013-4551-8fcb-a04d579a7f4f2.gif)
![微軟企業(yè)庫3.x概述_第3頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/12/fc3edbad-f013-4551-8fcb-a04d579a7f4f/fc3edbad-f013-4551-8fcb-a04d579a7f4f3.gif)
![微軟企業(yè)庫3.x概述_第4頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/12/fc3edbad-f013-4551-8fcb-a04d579a7f4f/fc3edbad-f013-4551-8fcb-a04d579a7f4f4.gif)
![微軟企業(yè)庫3.x概述_第5頁](http://file3.renrendoc.com/fileroot_temp3/2021-12/12/fc3edbad-f013-4551-8fcb-a04d579a7f4f/fc3edbad-f013-4551-8fcb-a04d579a7f4f5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、Enterprise Library 3.1 概述深圳.NET俱樂部管理團(tuán)隊黃耀輝QQ:126940MSN:RBlog: R2007年6月30日概述概述設(shè)計模式與最佳實(shí)踐(patterns & practices)可重用組件相當(dāng)重要.NET企業(yè)級開發(fā)重要參考ReusableExtensibleModifiable (Open Source)進(jìn)化自Application Blocks,通過配置應(yīng)用程序塊通過配置應(yīng)用程序塊(1.1)將以將以往完全獨(dú)立的往完全獨(dú)立的Application Blocks”可插撥可插撥”地整合在一地整合在一起起.封裝.NET框架類庫,Winform、Webform適用適
2、用于任何應(yīng)用類型及架構(gòu)風(fēng)格可以按原樣或以此為起點(diǎn)構(gòu)建您的程序庫或框架p&p Enterprise LibraryEnterprise Library EcosystemPartner blocksCustomer blocksCommunity blocksp&p blocksPartner X libraryCustomer Y libraryCustomer Z libraryApplication Block Software Factory andSpecificationsEnterprise Library企業(yè)庫是是企業(yè)開發(fā)中提供公共服務(wù)的構(gòu)件倉庫一組可在任何風(fēng)格的架構(gòu)下工作的幫助
3、器類代碼級的架構(gòu)指導(dǎo),并且這些代碼是完全開源的,你可以任意修改和擴(kuò)展免費(fèi)下載企業(yè)庫不是不是.NET Framework的一部分強(qiáng)行讓你按它的架構(gòu)風(fēng)格去編程的應(yīng)用框架 直接得到微軟技術(shù)支持、兼容性及本地化的產(chǎn)品待售企業(yè)庫的演進(jìn)及組成企業(yè)庫的演進(jìn)及組成企業(yè)庫版本2005年1月 企業(yè)庫1.0 For .NET Framework 1.12005年6月 企業(yè)庫1.1 For .NET Framework 1.1 (June 2005)2006年1月 企業(yè)庫2.0 For .NET Framework 2.0 (January 2006)2007年4月 企業(yè)庫3.0 For .NET Framework
4、 2.0 and 3.0 (April 2007)2007年5月 企業(yè)庫3.1 For .NET Framework 2.0 and 3.0 (April 2007)企業(yè)庫的組成The Enterprise Library Application BlocksThe Enterprise Library Configuration Console企業(yè)庫企業(yè)庫1.1組成組成Enterprise Library for .NET Framework 2.0Plug-inCoreBlock DependencyOptional ProviderDependencyEnterprise Library
5、 3.0 Application BlocksPlug-inCoreEnterprise Library 3.x 目目標(biāo)標(biāo)注重收集現(xiàn)有的應(yīng)的用程序塊的熱烈反饋提供新的應(yīng)用程序塊來支持企業(yè)開發(fā)中的其它常見問題集成.NET Framework 3.0中的相關(guān)功能改善關(guān)鍵開發(fā)活動的體驗簡單化開發(fā)新應(yīng)用程序塊和擴(kuò)展原有應(yīng)用程序塊的過程兼容 Enterprise Library 2.0Enterprise Library 3.x 新特性一覽新特性一覽新的應(yīng)用程序塊Validation Application BlockPolicy Injection Application Block (策略注入)改善
6、現(xiàn)有應(yīng)用程序塊Data Access Application BlockLogging Application Block.NET Framework 3.0 集成Logging, Exception Handling and Validation Application Blocks配置改善集成于Visual Studio的配置工具Environmental Overrides Manageable Configuration Source自動化Application Block Software FactoryStrong Naming Guidance Package系統(tǒng)需求系統(tǒng)需求Mi
7、crosoft Windows XP Professional, Windows Server 2003, or Windows Vista operating system Microsoft .NET Framework 2.0 or 3.0. You need .NET Framework 3.0 for: The Application Block Software Factory The Validation Application Block Windows Communication Foundation (WCF) adapter The Exception Handling
8、Application Block Windows Communication Foundation (WCF) exception shielding functionalityMicrosoft Visual Studio 2005 Application Block Software Factory 和 Strong-Naming Guidance Package需要Guidance Automation Extensions (GAX) ,如果需要修改和編譯指導(dǎo)包則另外還需要 Guidance Automation Toolkit (GAT)Data Access Applicatio
9、n Block需要.NET Framework 2.0中的ADO.NET數(shù)據(jù)提供者. 其可以訪問包括 SQL Server 2000以上版本, SQL Server 2005 Compact Edition, 和 Oracle 9i以上版本. 還有其它支持OLE DB 或 ODBC的其它數(shù)據(jù)源. 發(fā)布內(nèi)容發(fā)布內(nèi)容預(yù)編譯好的強(qiáng)簽名程序集預(yù)編譯好的強(qiáng)簽名程序集. 源代碼源代碼. 包括企業(yè)庫所有應(yīng)用程序塊、指導(dǎo)包、配置工具單元測試及快速入門的源代碼單元測試單元測試. 包括所有開發(fā)時創(chuàng)建的單元測試. 快速入門快速入門.快速入門是通過簡短易懂的代碼快速入門是通過簡短易懂的代碼演示企業(yè)庫的核心功能演示企業(yè)
10、庫的核心功能.所有的企業(yè)庫應(yīng)用所有的企業(yè)庫應(yīng)用程序塊都有獨(dú)立的快速入門程序塊都有獨(dú)立的快速入門. 文檔文檔. 與MSDN集成的文檔指引如何使用企業(yè)庫和企業(yè)庫中所有對象的引用. Enterprise Library 3.0 Application BlocksPlug-inCoreThe CoreConfigurationConfiguration Design & ToolingInstrumentationObject Builder配置配置所有企業(yè)庫應(yīng)用程序塊都是可配置的控制各個應(yīng)用程序塊如果運(yùn)作指定使用哪個插件程序塊可以使用或者不使用配置文件工廠使用配置文件中的數(shù)據(jù)創(chuàng)建相應(yīng)對象可以直接使
11、用原始數(shù)據(jù)類型來創(chuàng)建對象配置數(shù)據(jù)默認(rèn)保存至標(biāo)準(zhǔn)的App.config和Web.config文件中Alternative “Configuration Sources” can be usedShips with System, File, Manageable and SQL configuration sourcesConfiguration Design & Tooling配置工具輔助您完成XML配置文件的編輯快速完成應(yīng)用程序塊的默認(rèn)配置強(qiáng)類型屬性和提供者保存前校驗配置數(shù)據(jù)加密配置節(jié)指定在不同環(huán)境下的配置數(shù)據(jù)(development, test, production, etc.)提供Vi
12、sual Studio集成的配置工具和單獨(dú)的配置工具新的配置工具可以為您的應(yīng)用配置和擴(kuò)展塊配置提供一樣良好體驗監(jiān)測程序監(jiān)測程序(Instrumentation)可以對企業(yè)庫程序塊進(jìn)行監(jiān)測,有助于開發(fā)、測試和操作的進(jìn)行。事件日志性能計數(shù)器WMI 事件默認(rèn)情況下,所有監(jiān)測程序都是關(guān)閉的??梢酝ㄟ^配置工具將個別的監(jiān)測程序啟動安裝監(jiān)測程序需要有Windows管理員權(quán)限,并且能正確執(zhí)行installutil.exe命令監(jiān)測程序代碼包含在公共程序集中,以便重用Object BuilderDI 框架在各個P&P模塊間共享組件負(fù)責(zé)在應(yīng)用程序塊內(nèi)部創(chuàng)建對象調(diào)用工廠并從配置文件中獲取需要創(chuàng)建的對象類型為程序塊配置
13、測試程序作為構(gòu)建自己的應(yīng)用程序塊的杠桿,但對于使用企業(yè)庫的程序員來講它是透明的更多信息請查看官方站點(diǎn)和其它資源downloads at http:/ Inside ObjectBuilder系列http:/ Library 3.0 Application BlocksPlug-inCore異常處理異常處理(Exception Handling )場景場景應(yīng)用需要一致的異常管理手段異常處理的最佳實(shí)踐指導(dǎo)不向遠(yuǎn)程調(diào)用者暴露安全敏感信息將上下文中產(chǎn)生的異常包裝或替換為相關(guān)異常能方便地添加異常處理代碼Exception Handling Application Block為應(yīng)用提供簡單且一致的異常處理
14、模型通過定義“異常策略”來指定當(dāng)某種異常被拋出后的行為,例如:ApplicationException類型的異常將被日志 記錄SqlClientException類型的異常將被捕獲和包裝為DataLayerException類型異常并重新拋出SecurityException類型的異常將被替換為AccessDeniedException類型異常并拋出內(nèi)置的行為有記錄日志(Logging)包裝為其它的異常類型替換為其它異常類型影射為WCF Fault ContractException Handling - Exampletry some code that may throwCatch (Ex
15、ception ex)If (ExceptionPolicy.HandleException(ex, “Data Layer Policy”) throw;Enterprise Library 3.0 Application BlocksPlug-inCore日志場景日志場景需要記錄業(yè)務(wù)行為和數(shù)據(jù)操作需要提供產(chǎn)品的跟蹤支持提供審核以提高應(yīng)用的安全性日志信息可過濾處理,并且日志信息是可格式化的日志信息可以使用多種日志機(jī)制來記錄日志Logging Application Block為日志事件提供簡單的編程模型強(qiáng)類型的, 可擴(kuò)展的日志信息架構(gòu)構(gòu)建于 System.Diagnostics 之上配置驅(qū)動
16、 運(yùn)行時決定需要日志的信息使用.NET相關(guān)的TraceListener對象完成日志任務(wù), 并內(nèi)置提供多種日志接收器包括:EventLog, Database, Flat File, Rolling Flat File, MSMQ, E-mail, WMI, XML 甚至創(chuàng)建自己的接收器對象跟蹤類讓你記錄關(guān)鍵活動和關(guān)聯(lián)任何相關(guān)事件Logging - Examples LogEntry log = new LogEntry(); log.Message = “Your message here”; log.Priority = 1; log.EventId = 100; log.Categorie
17、s.Add(UI); log.Categories.Add(Debug); Logger.Write(log);/ Or if you prefer one line.Customer cust = GetCustomer(123);/ Log the customer will call cust.ToString() for the log entryLogger.Write(cust, category, priority);Enterprise Library 3.0 Application BlocksPlug-inCore數(shù)據(jù)訪問場景數(shù)據(jù)訪問場景需要簡單高效地訪問常規(guī)數(shù)據(jù)庫開發(fā)時對
18、多種數(shù)據(jù)庫類型的訪問透明SQL Server, SQL Server CE, Oracle, OLE-DB, ODBC, 需要使物理數(shù)據(jù)庫實(shí)例和邏輯數(shù)據(jù)庫實(shí)例間接關(guān)聯(lián)簡便地調(diào)整和校驗數(shù)據(jù)庫配置Data Access Application Block封裝ADO.NET對象,并應(yīng)用最佳實(shí)踐方式提供簡單的數(shù)據(jù)訪問方法.(每種方法提供大量重載,適應(yīng)各種調(diào)用需求和習(xí)慣)改善一致性編碼時不需要考慮最終數(shù)據(jù)存儲到哪個品牌的數(shù)據(jù)庫中整合 System.Transactions命名空間中的對象完成事務(wù)功能改善易用性單行代碼完成存儲過程調(diào)用讓DAAB管理數(shù)據(jù)庫連接對象的生命周期把連接字符串保存到配置文件或者在編
19、碼時指定Data Access - ExamplesPublic DataSet GetProductsInCategory(int categoryID) Create the Database object, using the database instance with the specified logical name. This is mapped to a connection string in the configuration file Database db = DatabaseFactory.CreateDatabase(Sales) Invoke the store
20、d procedure with one line of code! return db.ExecuteDataSet(GetProductsByCategory, categoryID) Note: connection was closed by ExecuteDataSet method call public Dataset GetProductsInCategory(string connectionString, int category) / Create the Database object, using the specified connection string Sql
21、Database db = new SqlDatabase(connectionString); / Invoke the stored procedure with one line of code! return db.ExecuteDataSet(GetProductsByCategory, category); / Note: connection was closed by ExecuteDataSet method call Enterprise Library 3.0 Application BlocksPlug-inCore緩存場景緩存場景創(chuàng)建智能客戶端時,在本地緩存數(shù)據(jù)并支持
22、離線操作創(chuàng)建應(yīng)用時需要緩存數(shù)據(jù),數(shù)據(jù)內(nèi)容持久化至應(yīng)用重啟Note: ASP.NET cache (System.Web.Caching) can be used across multiple application types and is generally a better choice for applications that dont require the cache to be persistedCaching Application Block提供一種靈活且可擴(kuò)展的緩存機(jī)制,可用于企業(yè)級應(yīng)用中的各個層支持緩存使用數(shù)據(jù)庫或其它獨(dú)立的數(shù)據(jù)存儲作為后臺存儲, 因此數(shù)據(jù)可以保存到應(yīng)用
23、重啟線程安全確保內(nèi)存中的狀態(tài)項與后臺存儲保持同步 Enterprise Library 3.0 Application BlocksPlug-inCore加密場景加密場景需要對敏感數(shù)據(jù)通過對稱密鑰進(jìn)行加密后存儲到數(shù)據(jù)庫,然后讀取還原數(shù)據(jù)需要在單機(jī)上加密信息(不使用密鑰) 需要將密碼經(jīng)過Hash加密后保存到數(shù)據(jù)庫中,并且需要比較用戶提供的密碼是否有效Cryptography Application Block改善安全性提供簡單方法實(shí)現(xiàn)常規(guī)加密場景的需求改善易用性Provides operations on both strings and byte streamsCreateHash, Comp
24、areHash, EncryptSymmetric, DecryptSymmetric改善集成性支持所有.NET框架中內(nèi)置的加密算法,或者應(yīng)用您自己定制的算法支持DPAPI實(shí)現(xiàn)單機(jī)上的無密鑰加密可通過配置工具管理加密算法和密鑰Enterprise Library 3.0 Application BlocksPlug-inCore安全場景安全場景需要給用戶授權(quán)使用一或多種安全系統(tǒng)或機(jī)制需要在整個登錄會話期間內(nèi)緩存認(rèn)證或授權(quán)數(shù)據(jù)Note: The original release of the Enterprise Library Security Application Block also s
25、upported Authentication, Profile and Roles. This is now supported by the .NET Membership and Profile class, so this functionality has been removed from the block.ASP.NETSecurity Application Block + ASP.NET封裝通用的應(yīng)用安全任務(wù)使用標(biāo)準(zhǔn)的Provider 模型實(shí)現(xiàn)通用安全任務(wù)最小化自定義安全相關(guān)代碼讓應(yīng)用安全獲得完整的最佳實(shí)踐ClientCodeSecurity Application Blo
26、ckMembershipProfileMembershipProviderProfileProviderAuthorizationFactorySecurityCacheFactoryIAuthorizationProviderISecurityCacheProviderAuthorizationRuleProviderCachingStoreProviderAzManAuthorizationProviderActiveDirectoryMembershipProviderSqlMembershipProviderSqlProfileProviderEnterprise Library 3.
27、0 Application BlocksPlug-inCore驗證場景驗證場景需要檢查數(shù)據(jù)在處理之前是有效的數(shù)據(jù)從最終用戶或非信任系統(tǒng)輸入改善安全和系統(tǒng)響應(yīng)需要使校驗邏輯易于維護(hù)在開發(fā)時和開發(fā)后需要在應(yīng)用的不同層中驗證相同的數(shù)據(jù)使用一致的驗證邏輯需要無縫地集成驗證到應(yīng)用的不同層中用戶界面層和Web Service界面層Validation Application Block一次性指定驗證規(guī)則在配置中,使用特性(attributes), 編程活動Programmatically 在應(yīng)用的任何地方簡易地驗證數(shù)據(jù)編程環(huán)境Programmatically集成到 Windows Forms, ASP.N
28、ET 或 WCF可組合驗證邏輯內(nèi)置公共的基本驗證規(guī)則庫在類型成員上聯(lián)合驗證規(guī)則并使用布爾邏輯在同一類型上應(yīng)用多重驗證規(guī)則Validation ExampleStringLengthValidator(1, 50, Ruleset=RuleSetA, MessageTemplate=Last Name must be 1-50 characters)public string LastName get return lastName; set lastName = value; RegexValidator(w+(-+.w+)*w+(-.w+)*.w+(-.w+)*, MessageTempla
29、te=Invalid e-mail address, Ruleset=RuleSetA)public string Email get return email; set email = value; Validator validator = ValidationFactory.CreateValidator(Ruleset);ValidationResults results = validator.Validate(customer);if (!results.IsValid) foreach (ValidationResult result in results) Console.Wr
30、iteLine(Message=0, Key=1, Tag=2, result.Message, result.Key.ToString(), result.Tag = null ? null : + result.Tag.ToString() + ); Specify validation rules in attributesor in configurationValidate objects and process resultsEnterprise Library 3.0 Application BlocksPlug-inCorePolicy Injection Applicatio
31、n Block 目標(biāo)目標(biāo)從業(yè)務(wù)邏輯中分離跨領(lǐng)域邏輯使用攔截(interception)和注入(injection)的方式在運(yùn)行時應(yīng)用策略允許使用配置或特性來定義策略為通用場景提供配置規(guī)則在粗粒度(命名空間或程序集中的所有類型)或細(xì)粒度級(指定成員或特性)別應(yīng)用策略包含處理器(handlers),它們集成了企業(yè)庫來實(shí)現(xiàn)通用的交叉事務(wù)Validation, Logging, Authorization, Exception Handling, Caching, Performance Counters允許用戶自定義攔截機(jī)制Customer GetCustomerById(int id) if (i
32、d 0) throw new ArgumentException(Invalid Customer Id); Customer customer = HttpContext.Current.Cache.Get(id.ToString() as Customer; if (customer != null) return customer; try Database db = DatabaseFactory.CreateDatabase(CRM); using (IDataReader reader = db.ExecuteReader(spGetCustomerById, id) if (re
33、ader.Read() customer = new Customer(id, reader.GetString(0), reader.GetString(1); HttpContext.Current.Cache.Add(id.ToString(), customer, null, DateTime.Now.AddMinutes(1), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null); return customer; return null; catch (Exception ex) if (ExceptionPolic
34、y.HandleException(ex, Data Policy) throw; return null; Sample MethodValidationCallHandlerCachingCallHandler(0, 1, 0)Tag(Data Access)Customer GetCustomerById( RangeValidator(0, RangeBoundaryType.Inclusive, 0, RangeBoundaryType.Ignore) int id) Database db = DatabaseFactory.CreateDatabase(CRM); using (IDataReader reader = db.ExecuteReader(spGetCustomerById, id) if (reader.Read() return new Customer(id, reader.GetString(0), reader.GetString(1); Sample Method with Policy InjectionPolicy Injection Scenarios從業(yè)務(wù)邏輯中分離跨領(lǐng)域邏輯使用攔截(interception)和注入(injection)的方式在運(yùn)行時應(yīng)用策略提供聲明性方式來指定策略應(yīng)用在哪
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年糧食加工設(shè)備合作協(xié)議書
- 2025年防殺病毒軟件合作協(xié)議書
- 外研版新教材七年級上冊英語重點(diǎn)單詞短語默寫紙
- 2025年胃腸解痙藥合作協(xié)議書
- 2025年事業(yè)單位臨時工勞動合同樣本(三篇)
- 2025年中國房屋租賃合同(2篇)
- 2025年產(chǎn)品外協(xié)加工合同范文(2篇)
- 2025年互聯(lián)網(wǎng)辦稅軟件服務(wù)協(xié)議范文(2篇)
- 2025年交通事故死亡賠償協(xié)議范文(2篇)
- 山西省2024七年級道德與法治上冊第四單元追求美好人生第十三課實(shí)現(xiàn)人生價值情境基礎(chǔ)小練新人教版
- 變壓器更換施工方案
- 【高分復(fù)習(xí)筆記】陳澄《新編地理教學(xué)論》筆記和課后習(xí)題詳解
- 安徽新宸新材料有限公司年產(chǎn)6000噸鋰離子電池材料雙氟磺酰亞胺鋰項目環(huán)境影響報告書
- 日本酒類消費(fèi)行業(yè)市場分析報告
- GB/T 29594-2013可再分散性乳膠粉
- 西子奧的斯電梯ACD2調(diào)試說明書
- 成長感恩責(zé)任高中主題班會-課件
- 化工裝置實(shí)用操作技術(shù)指南
- 建設(shè)項目全過程工程咨詢服務(wù)指引(咨詢企業(yè)版)(征求意見稿)
- 分手的協(xié)議書模板(5篇)
- 2020年度安徽省中考數(shù)學(xué)科目試卷
評論
0/150
提交評論