文档详情

微软企业库3.x概述.pptx

发布:2017-05-26约2.25千字共54页下载文档
文本预览下载声明
Enterprise Library 3.1 概述;概述;;Enterprise Library;企业库的演进及组成;企业库1.1组成;Caching;Caching;Enterprise Library 3.x 目标;Enterprise Library 3.x 新特性一览;系统需求;发布内容;Caching;The Core;配置;Configuration Design Tooling;监测程序(Instrumentation);Object Builder;Caching;异常处理(Exception Handling )场景;Exception Handling Application Block;Exception Handling - Example;Caching;日志场景;Logging Application Block;Logging - Examples;Caching;数据访问场景;Data Access Application Block;Data Access - Examples;Caching;缓存场景;Caching Application Block;Caching;加密场景;Cryptography Application Block;Caching;安全场景;ASP.NET;Caching;验证场景;Validation Application Block;Validation Example;Caching;Policy Injection Application Block – 目标;Customer GetCustomerById(int id) { if (id 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 (reader.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 (ExceptionPolicy.HandleException(ex, Data Policy)) throw; return null; } };[ValidationCallHandler] [CachingCallHandler(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), r
显示全部
相似文档