简体   繁体   English

数据访问层设计模式

[英]Data access layer design pattern

I need to build a data access layer and I am looking for the right design pattern. 我需要构建一个数据访问层,并且正在寻找正确的设计模式。

what I need is: 我需要的是:

  1. object mapping: it shouldn't be too complicated and not generic. 对象映射:不应太复杂也不通用。
  2. I have a lot of look up tables and I need to a good way to load them. 我有很多查询表,我需要一种很好的方式来加载它们。 I don't care about starting time (when the program starts up), what I care is to minimizing the number of connections to the db and on the other hand not killing the virtual memory. 我不在乎启动时间(程序启动时),我关心的是最大程度地减少与db的连接数,而另一方面不会杀死虚拟内存。
  3. relationships: I have a lot of connected objects which relate to each other and I need a generic way to load as much as relationships as I want. 关系:我有很多相互关联的对象,我需要一种通用的方式来加载尽可能多的关系。

Number 2(above) is most critical for me. 第二个(以上)对我来说至关重要。 Any suggestions? 有什么建议么?

Thanks 谢谢

It looks like the Facade pattern could be used here. 看起来可以在这里使用Facade模式。

and maybe the Singleton pattern too. 也许还有Singleton模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM