《企业程序库的概述.pptx》由会员分享,可在线阅读,更多相关《企业程序库的概述.pptx(46页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、LegendDependencyPlug-inEditorFontData EditorFontData configData = New EditorFontData(); EditorFontData();configData.Name = fontDialog.Font.Name;configData.Name = fontDialog.Font.Name;configData.Size = fontDialog.Font.Size;configData.Size = fontDialog.Font.Size;configData.Style = Convert.ToInt32(font
2、Dialog.Font.Style);configData.Style = Convert.ToInt32(fontDialog.Font.Style);/write an object info to config file/write an object info to config fileConfigurationManager.WriteConfiguration(EditorSettings, configData);ConfigurationManager.WriteConfiguration(EditorSettings, configData);Public EditorFo
3、ntData()Public EditorFontData() Private string fontName; Private string fontName; Private Double fontSize; Private Double fontSize; Private Integer fontStyle; Private Integer fontStyle; / Read an object with multiple properties/ Read an object with multiple propertiesEditorFontData EditorFontData co
4、nfigData = ConfigurationManager.GetConfiguration(EditorSettings)ConfigurationManager.GetConfiguration(EditorSettings)Public Function GetProductsInCategory(ByRef Category As Integer) As DataSet Create the Database object, using the default database service. The default database service is determined
5、through configuration. Dim db As Database = DatabaseFactory.CreateDatabase() Invoke the stored procedure with one line of code! return db.ExecuteDataSet(GetProductsByCategory, Category) Note: connection was closed by ExecuteDataSet method call End FunctionDataSet customersDataSet try customersDataSe
6、t = RunQuery(“GetAllCustomers”); catch(Exception ex) string formattedInfo = FormatException(ex); Logging.Log(formattedInfo) Throw new DataAccessException(“Database access failure for query GetAllCustomers”,e)Without Exception Handling App Block1.0DataSet customersDataSettry customersDataSet = RunQue
7、ry(“GetAllCustomers”); catch(Exception ex) if (ExceptionPolicy.HandleException(ex, “Data Access Policy”) throw; Exception policy: “Data Access Policy”Exception type: System.Data.SqlClient.SqlExceptionException Handler: Logging Handler Wrap Handlerexceptionhandling.configWith Exception Handling App Blockp&p Enterprise LibraryPartner blocksCustomer blocksCommunity blocksp&p blocksPartner X libraryCustomer Y libraryCustomer Z libraryBlock Specification
限制150内