| As two major data-describing model, Object model and Relation model,have their own defferent characteristic and theoretical principle ,which is object model describes the realitical thing and designs the complicated software system using the object.This is th reason why the OOP(object–oriented programming ) is the major method of software development and the principle of business data analysis. The reality , which is the OODB is not popular,frustrates the software developer,because the RDB is still the most important mechanism for data store. But they has defferent principle of describing data, there is the problem between them called impedence-mismatch.In most applications, the temporary data store in memory need to be persistent to the RDB, so the developer spent most time and energy to transit the object data to the relation data and solute the data store in RDB.For the destination of data manipulation in RDB, the methods include: 1. SQL embedded in the application code, using another words, compile SQL code to directly to manipulate the DB data in the application;2.the local encapulation by which the SQL code is embedded in data class; The two ways cause the coupling problem between the two data mode, so any changes of the two mode will recompile the application.They are fitted to the small applicatin or RAD. 3.Persistence layer made for ORM(object-relation mapping).The application developers who don't need to know about the RDB and the data store in the DB ,can manipulate the data in the RDB transparently. Not only can it solute the impedenc-mismatch problem, but the efficiency thing. Many things, like performance, read frequerence, extensibility, space consumption, trasactioan support,cursor and so on ,make the persistence layer be sized up to the application .Inorder to satisfy the command from the applicatin ,the persistence need too be reconsidered .A common persisitence need to support the mapping of class, property, method ralationship, inheritence and the data integrity which are the fundemental functions. In the paper, the examples are used to help understanding the mapping method, to compare the defferent ways to achieve the same goal and to conclude the principle of choosing the right method.The framework named Netlight described in this paper is base on Microsoft .NET on which there still has no integrated frame. The middleware frame is not just for ORM and object persistence just primary module, at the same time, it provides function for entity controlment and business principle and so on.Netlight is the middleware frame that can solute the ORM, although it is light and comparatively simple, the design idea is bases on the structure layer, has clear structure and can be improved to for the enterprise-layed design after function reinforced. Compared to regular framework, it subdivides the data entity into two layers, data entity and data manipulation layers, which make the business layer's code more concise and low the coupling degree. Netlight is designed to five layers, business fa?ade, entity controlment, business logic, data entity and data access layers, to encapulate the access to deferent database, data express, data insert, select , delete and update ,business logic and business sevice. After this, the upper layer just use the operation encapsulated in the lower layer, and don't care the operation detail. Each component in the system has it's special task, which makes the code clear, decouples system components, enhances the system maintainability and improve the application development's efficiency.Related to the class architecture of Netlight, this paper presented detailed the ORM principle, the encapulation of database access, the data entity expression, data entity controlment, business logic and business service. At the same time, the key class, the staple method and the transfer among entities are presented in this paper.Another lightspot in this paper is the implementation of new technology named AOP(aspect oriented programming) in the middleware instead of OO method. It solute some module trasfer , which is some module like ID authetication,log record that belong to the system but offen are transferred by business logic. It makes up for the deficiency sometimes made by OO method, decouples these modules from business logic. |