CN102819590A - C#-based quick data access layer implementation method - Google Patents
C#-based quick data access layer implementation method Download PDFInfo
- Publication number
- CN102819590A CN102819590A CN2012102771743A CN201210277174A CN102819590A CN 102819590 A CN102819590 A CN 102819590A CN 2012102771743 A CN2012102771743 A CN 2012102771743A CN 201210277174 A CN201210277174 A CN 201210277174A CN 102819590 A CN102819590 A CN 102819590A
- Authority
- CN
- China
- Prior art keywords
- layer
- data access
- implementation method
- attribute
- access layer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Abstract
The invention discloses a C#-based quick data access layer implementation method, wherein a three-layer structure is involved and is provided with a User model layer, a User Controller service layer and a User Provider data layer. The C#-based quick data access layer implementation method comprises the following steps of: (1) defining one or two attribute classes; (2) analyzing the model layer; (3) defining a base data layer Base Provider attract class and practical classes of various data types; (4) defining a data access layer factory Provider Manager; and (5) switching and combining between different data access modes. In the mode provided by the invention, a large amount of development workload and unit testing workload is saved undoubtedly for development personnel; and when the structure of the model changes, other functions are not required to be modified yet.
Description
Technical field
The present invention relates to a kind of quick data access layer implementation method based on C#.
Background technology
Passed through nearest 20 years, OOP technology (object-oriented (00) programming technologies) has got into a stable developing stage in the application of industrial circle.The programmer has admitted the characteristic of speech sounds as type (classes), an object (objects), method (methods) now.C# is a kind of typical object oriented language, and a kind of development scheme commonly used just is based on OO three-tier architecture now.Three-tier architecture on the ordinary meaning is used whole service exactly and is divided into: presentation layer (UI), Business Logic (BLL), data access layer (DAL).The purpose of distinguishing level is promptly for the thought of " high cohesion, low coupling ".Data access layer direct control database wherein is to operations such as different model (Model) data increase, delete, change, look into.
Summary of the invention
Technical matters to be solved by this invention provides a kind of workload of mass development and workload of unit testing of saving, and changes when model structure, does not also need the quick data access layer implementation method based on C# of related other functions of modification.
The present invention realizes through following technical scheme: a kind of quick data access layer implementation method based on C#; Comprise three-layer structure; Said three-layer structure has User model layer, UserController operation layer and UserProvider data Layer, and its step is following:
1) defines one or two Attribute class;
2) model layer is resolved;
3) definition basic data layer BaseProvider abstract class, and the utility classes of various data types;
4) ProviderManager of data access layer factory;
5) switching between the different pieces of information access module and combination.
Further, said Attribute class comprises Table Properties class and field attribute.
Further, said Table Properties comprises table name, major key, connection name and default sort attribute.
Further, said field attribute comprises field type and field length attribute.
The beneficial effect of the quick data access layer implementation method based on C# of the present invention is: reduce developer's workload, aspect data access layer, reach the effect of quick exploitation.Concrete having a few as follows: 1) minimizing can significantly improve work efficiency in the overlapping development of data access layer; 2) easily realize disparate databases, the parallel and switching of different pieces of information access type (such as Oracle and Ms sql); 3) fast run-up table; 4) discern the corresponding data access classes automatically for needs expanded data function.
Embodiment
A kind of quick data access layer implementation method based on C# comprises three-layer structure, and said three-layer structure has User model layer, UserController operation layer and UserProvider data Layer, and its step is following: 1) define one or two Attribute class; 2) model layer is resolved; 3) definition basic data layer BaseProvider abstract class, and the utility classes of various data types; 4) ProviderManager of data access layer factory; 5) switching between the different pieces of information access module and combination.
Wherein, said Attribute class comprises Table Properties class and field attribute.Said Table Properties comprises table name, major key, connection name and default sort attribute.Said field attribute comprises field type (major key and common) and field length attribute.
Embodiment 1
1) calls certain model data access layer instance;
2) judge whether the existing buffer memory that waits for quietly;
3) existingly wait for buffer memory quietly and return instance.
Embodiment 2
1) calls certain model data access layer instance;
2) judge whether the existing buffer memory that waits for quietly;
3) do not wait for buffer memory quietly and get into the data access class that judges whether correspondence;
4) have corresponding data access class get into instantiation such;
5) this instance is put into static cache;
6) return instance.
Embodiment 3
1) calls certain model data access layer instance;
2) judge whether the existing buffer memory that waits for quietly;
3) do not wait for buffer memory quietly and get into the data access class that judges whether correspondence;
4) do not have corresponding data access class get into instantiation such;
5) the connected mode generation according to this model changes corresponding instance;
6) this instance is put into static cache;
7) return instance.
Appendix User model layer
Appendix UserController operation layer
Appendix UserProvider data Layer
The beneficial effect of the quick data access layer implementation method based on C# of the present invention is: reduce developer's workload, aspect data access layer, reach the effect of quick exploitation.Concrete having a few as follows: 1) minimizing can significantly improve work efficiency in the overlapping development of data access layer; 2) easily realize disparate databases, the parallel and switching of different pieces of information access type (such as Oracle and Ms sql); 3) fast run-up table; 4) discern the corresponding data access classes automatically for needs expanded data function.
The above is merely embodiment of the present invention, but protection scope of the present invention is not limited thereto, and any variation or replacement of expecting without creative work all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain that claims were limited.
Claims (4)
1. quick data access layer implementation method based on C#, it is characterized in that: comprise three-layer structure, said three-layer structure has User model layer, UserController operation layer and UserProvider data Layer, and its step is following:
1) defines one or two Attribute class;
2) model layer is resolved;
3) definition basic data layer BaseProvider abstract class, and the utility classes of various data types;
4) ProviderManager of data access layer factory;
5) switching between the different pieces of information access module and combination.
2. the quick data access layer implementation method based on C# according to claim 1, it is characterized in that: said Attribute class comprises Table Properties class and field attribute.
3. the quick data access layer implementation method based on C# according to claim 2, it is characterized in that: said Table Properties comprises table name, major key, connection name and default sort attribute.
4. the quick data access layer implementation method based on C# according to claim 2, it is characterized in that: said field attribute comprises field type and field length attribute.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012102771743A CN102819590A (en) | 2012-08-06 | 2012-08-06 | C#-based quick data access layer implementation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012102771743A CN102819590A (en) | 2012-08-06 | 2012-08-06 | C#-based quick data access layer implementation method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102819590A true CN102819590A (en) | 2012-12-12 |
Family
ID=47303701
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2012102771743A Pending CN102819590A (en) | 2012-08-06 | 2012-08-06 | C#-based quick data access layer implementation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102819590A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955511A (en) * | 2014-04-30 | 2014-07-30 | 华南理工大学 | Cloud platform data organization and retrieval method for 3D (three-dimensional) urban building data |
CN108494832A (en) * | 2018-02-26 | 2018-09-04 | 武汉斗鱼网络科技有限公司 | Direct broadcasting room is full frame and half screen message unifies the method, readable medium and the equipment that encapsulate |
CN108599294A (en) * | 2018-04-18 | 2018-09-28 | 上海工程技术大学 | A kind of new energy charge and discharge control and data storage device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101673361A (en) * | 2008-09-12 | 2010-03-17 | 北京正辰科技发展有限责任公司 | Technical architecture for order distribution system |
CN101882069A (en) * | 2009-05-08 | 2010-11-10 | 北京正辰科技发展有限责任公司 | Frame structure of multi-level digital city supervision system based on 3S (GIS, Geographic Information System/GPS, Global Position System/RS, Radio Station) |
-
2012
- 2012-08-06 CN CN2012102771743A patent/CN102819590A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101673361A (en) * | 2008-09-12 | 2010-03-17 | 北京正辰科技发展有限责任公司 | Technical architecture for order distribution system |
CN101882069A (en) * | 2009-05-08 | 2010-11-10 | 北京正辰科技发展有限责任公司 | Frame structure of multi-level digital city supervision system based on 3S (GIS, Geographic Information System/GPS, Global Position System/RS, Radio Station) |
Non-Patent Citations (1)
Title |
---|
黄钧航(JKHUANG): "打造属于你的提供者(Provider=Strategy+Factory Method)", 《HTTP://WWW.CNBLOGS.COM/RUSH/ARCHIVE/2011/08/28/2156312.HTML》, 28 August 2011 (2011-08-28) * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955511A (en) * | 2014-04-30 | 2014-07-30 | 华南理工大学 | Cloud platform data organization and retrieval method for 3D (three-dimensional) urban building data |
CN108494832A (en) * | 2018-02-26 | 2018-09-04 | 武汉斗鱼网络科技有限公司 | Direct broadcasting room is full frame and half screen message unifies the method, readable medium and the equipment that encapsulate |
CN108494832B (en) * | 2018-02-26 | 2021-04-09 | 武汉斗鱼网络科技有限公司 | Method, readable medium and device for uniformly packaging full-screen and half-screen messages in live broadcast room |
CN108599294A (en) * | 2018-04-18 | 2018-09-28 | 上海工程技术大学 | A kind of new energy charge and discharge control and data storage device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103279358B (en) | A kind of explanation type Service Component dynamic fixing method of Industry-oriented application | |
CN100557609C (en) | A kind of persistent layer generation method and device | |
CN103092996B (en) | Document data acquisition device and bills data acquisition methods | |
JP7047228B2 (en) | Data query methods, devices, electronic devices, readable storage media, and computer programs | |
CN105447051A (en) | Database operation method and device | |
CN106095698A (en) | OO caching write, read method and device | |
CN102298740A (en) | Business process management supporting method | |
CN102819590A (en) | C#-based quick data access layer implementation method | |
CN102981823A (en) | Domain driven development plug-in system | |
CN105468793B (en) | A kind of automatic management method of simulation model data | |
CN106126564A (en) | A kind of method rendered based on dynamic template language | |
CN101604286B (en) | Method for generating keyword-driving table | |
CN102722368B (en) | Plug-in software designing method based on document tree and message pump | |
CN107391201B (en) | Data flow realization method of software framework of dynamic service data | |
CN106874429B (en) | Method for converting standard SQL into full text retrieval standard query | |
CN111198711B (en) | Collection version control method and system based on MongoDB | |
CN100559345C (en) | The picture resource management method of embedded system interface | |
Jing et al. | The research of Hibernate cache technique and application of EhCache component | |
WO2016201813A1 (en) | Dynamic layout method and system based on android | |
CN109684329B (en) | Resource management method based on data center equipment | |
CN105808212B (en) | The extended method and system of product support tool | |
CN103124309B (en) | Method and terminal for read-write control of mobile phone files | |
CN103777957A (en) | Design method and system of model library with expandability | |
CN104503974A (en) | Automatic optimization method of relational database on the basis of cloud platform | |
CN104468952A (en) | Mobile communication terminal simulation test machine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20121212 |
|
RJ01 | Rejection of invention patent application after publication |