- 1、本文档共20页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
使用设计模式构建通用数据库访问类_c#(Build generic database access class _c # using design patterns)
Build generic database access class _C # using design patterns
Database access is very important in application design, and we typically need to focus on database access to ensure good encapsulation and maintainability. I, database access, for Microsofts own SqlServer and other databases (supporting OleDb), USES different access methods, which are distributed in the system.data.sqlclient and system.data.oledb namespace. Microsoft later introduced a class library specifically for accessing Oracle databases. We hope that at the time of writing application system, not affected by so many kind of different, can try to be database has nothing to do, when the backstage database is changed, dont need to change the client code.
Sometimes, for performance and other reasons, we also want to provide a cache of database access, especially database connections. While Microsoft has built-in database caching for us, it is undoubtedly more flexible and efficient to control the cache itself.
This requires that these database access classes be encapsulated again in the actual development process. Here, we introduce a real strategy that has a very good effect in practical application. The Factory and Silgleton design patterns are the primary means of use.
Lets take a look at the meaning of Factory first: define an interface for creating objects and let the subclass decide which class to instantiate. Factory Method delays the instantiation of a class to its subclasses. Here could we deal with for a variety of database operations, therefore, need to first define a manipulation of the database interface, and then, depending on the database, by the class is instantiated to decide which class factory.
Next, we first define this access interface. To illustrate the problem, weve defined fewer methods for this class, and other methods are easy to reference. Also note that I use the abstract class to define thi
您可能关注的文档
- 仓储单选(Warehousing radio).doc
- 仓库管理制度(Warehouse management system).doc
- 产品的跟踪物料(Product tracking materials).doc
- 产品介绍(Product introduction).doc
- 产品美学(Product aesthetics).doc
- 产品评估(Product evaluation).doc
- 产品示范(Product demonstration).doc
- 串口并口PCI 接口总结(Serial interface and PCI interface summary).doc
- 串行实时时钟芯片DS1302程序设计中的问题与对策(Problems and countermeasures of serial real-time clock chip DS1302 program design).doc
- 串口连接线制作方法(Method of serial connection).doc
- 中国国家标准 GB 42125.11-2025测量、控制和实验室用电气设备的安全要求 第11部分:用于处理医用材料的灭菌器和清洗消毒器的特殊要求.pdf
- 《GB 42125.11-2025测量、控制和实验室用电气设备的安全要求 第11部分:用于处理医用材料的灭菌器和清洗消毒器的特殊要求》.pdf
- 《GB/T 15237-2025术语工作及术语科学 词汇》.pdf
- GB/T 15237-2025术语工作及术语科学 词汇.pdf
- GB/T 22454-2025企业建模与体系结构 企业建模构件.pdf
- 中国国家标准 GB/T 15237-2025术语工作及术语科学 词汇.pdf
- 中国国家标准 GB/T 22454-2025企业建模与体系结构 企业建模构件.pdf
- 《GB/T 22454-2025企业建模与体系结构 企业建模构件》.pdf
- 中国国家标准 GB/T 18910.64-2025液晶显示器件 第6-4部分:测试方法 带动态背光的液晶显示模块.pdf
- 《GB/T 18910.64-2025液晶显示器件 第6-4部分:测试方法 带动态背光的液晶显示模块》.pdf
最近下载
- 年产8万吨聚甲醛工艺的初步设计.docx
- 3D3S 基本操作手册.pdf
- 2019新疆生产建设兵团中考化学真题.doc VIP
- 8.铁路工程预算定额 路基工程宣贯讲义.ppt
- 房地产市场报告 -天朗2024年报【在时代洪流的弄潮中 尽显从容-把脉逆周期调解下大的北京房地产市场】.docx
- 【人教部编版】二年级上册语文课件:4《田家四季歌》第一课时(共27张PPT).pptx
- 年产25万吨合成氨合成工段工艺设计.docx
- 2023徐州市八年级下册期末物理试卷含答案 .pdf
- 毕业设计(论文)-反铲式挖掘机工作装置结构设计.doc
- 工程训练(广东工业大学)智慧树知到期末考试答案章节答案2024年广东工业大学.docx
文档评论(0)