CN109947422A - A kind of Business Entity realization method and system based on Domain Driven Design - Google Patents

A kind of Business Entity realization method and system based on Domain Driven Design Download PDF

Info

Publication number
CN109947422A
CN109947422A CN201910192561.9A CN201910192561A CN109947422A CN 109947422 A CN109947422 A CN 109947422A CN 201910192561 A CN201910192561 A CN 201910192561A CN 109947422 A CN109947422 A CN 109947422A
Authority
CN
China
Prior art keywords
data
entity
layer
business
business entity
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.)
Granted
Application number
CN201910192561.9A
Other languages
Chinese (zh)
Other versions
CN109947422B (en
Inventor
宫保金
孙立新
张进
周由甲
王洁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN201910192561.9A priority Critical patent/CN109947422B/en
Publication of CN109947422A publication Critical patent/CN109947422A/en
Application granted granted Critical
Publication of CN109947422B publication Critical patent/CN109947422B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The Business Entity realization method and system based on Domain Driven Design that the invention discloses a kind of, belong to application development field, the technical problem to be solved in the present invention provides a unified frame how to develop for field core business logic, enhance the restraining force of development and application program, ensure that field layer exploitation is compact, and then requirement of the reduction to developer, the technical solution of use are as follows: a kind of Business Entity implementation method based on Domain Driven Design, steps are as follows: S1, establishing Business Entity model by Business Entity modeling tool;S2, Business Entity operation frame is established;S3, Cache Framework is established in Business Entity operation frame;S4, increment mechanism is established in Business Entity operation frame;S5, service logic is split as to entity logical layer and service logic layer;S6, Business Entity designer is established;S7, JIT generator is established.The Business Entity system based on Domain Driven Design that the invention also discloses a kind of.

Description

A kind of Business Entity realization method and system based on Domain Driven Design
Technical field
The invention belongs to application development fields, are related to the exploitation of field core business logic layer, specifically a kind of Business Entity realization method and system based on Domain Driven Design.
Background technique
As more and more application developments lack a unified frame since field core business logic is developed Frame lacks restriction ability, causes field layer exploitation more open, requires high and exploitation application program to exist exploitation proficiency It is weaker in stability and adaptation front end UI variation, it is unfavorable for the stabilization of service logic layer identification code.
Business Logic (Business Logic Layer) is undoubtedly the part that core value is embodied in system architecture.It Focus be concentrated mainly on related with the business demand system design such as the formulation of business rule, realization of operation flow, It is that say it is field (Domain) logic coped with system related, many times, Business Logic is also known as field Layer.So-called Three layer development is exactly that the entire service application of system is divided into expression layer, Business Logic and data access layer, Be conducive to exploitation, maintenance, deployment and the extension of system in this way.Layering be to realize " high cohesion, lower coupling ".Using " point and Control it " thought, problem is demarcated and carrys out piecemeal solution, it is easily controllable, extend and distribution resource.Business Logic is responsible for system Generation, processing and the conversion of logicality data are responsible in the processing of field business.Correctness to the logicality data inputted and Validity is responsible for, but the correctness of the logicality data and user's property data to output is not responsible, not to the presentation styles of data It is responsible for.
The patent document of Patent No. CN106815016A discloses a kind of MVVM design mould based on Domain Driven Design Type (DDMVVM) specifically includes that the MVVM based on Domain Driven Design designs a model, and overall architecture is divided into 4 layers: view layer, View model layer, domain model layer and infrastructure layer;MVVM design methods based on Domain Driven Design, specifically exist It is designed in two kinds of levels: strategy design and tactical design;MVVM model development frame based on Domain Driven Design, micro- Each layer that the MVVM based on Domain Driven Design designs a model is realized under letter small routine development platform.The technical solution solves The higher and higher problem of software complexity in front-end application exploitation, but cannot be mentioned for the exploitation of field core business logic For a unified frame, enhance the restraining force of development and application program, it is ensured that field layer exploitation is compact, and then reduces to exploit person The requirement of member to reduce development cost, while improving the stability of the application program of exploitation and adapting to front end UI variation Adaptability is conducive to the stabilization of service logic layer identification code.
Summary of the invention
Technical assignment of the invention is to provide a kind of Business Entity realization method and system based on Domain Driven Design, comes It solves how to develop for field core business logic and a unified frame is provided, enhance the restraining force of development and application program, really The layer exploitation of guarantor field is compact, and then reduces the requirement to developer, to reduce development cost, while improving the application of exploitation The stability of program and the adaptability for adapting to front end UI variation, are conducive to the stable problem of service logic layer identification code.
Technical assignment of the invention realizes in the following manner, and a kind of Business Entity based on Domain Driven Design is realized Method, steps are as follows:
S1, Business Entity model is established by Business Entity modeling tool: Business Entity model uses Domain Driven Design The physical model abstracted, for describing service logic;Business Entity model includes entity data structure and Business Logic Two parts;
S2, establish Business Entity operation frame: Business Entity operation frame provides the basic framework of service logic operation, industry Entity operation frame includes the most basic content of Business Logic, encapsulates public service logic realization extension mechanism, business Function is to add customized business logic codes based on this frame;
S3, Cache Framework is established in Business Entity operation frame, Cache Framework includes that session level cache layer, transaction-level are slow Deposit layer and movement grade cache layer three-level caching: the data of cache business logic different conditions, session level cache layer correspond to original Data, things grade cache corresponding Current transaction grade data, movement and the corresponding current operation grade data of caching, are meeting business function To the access frequency reduced in the requirements for access of different conditions data to database, whole efficiency is improved;
S4, increment mechanism is established in Business Entity operation frame: the data of front end caller return, front end modification are submitted Data and preservation when to submit to the data of database be incremental data, greatly reduce the transmission quantity of data, promoted Program feature;
S5, service logic is split as to entity logical layer and service logic layer, entity logical layer is most fine-grained business Logic splits layer, and service logic layer is used for the layout to entity logical layer and handles;
S6, it establishes Business Entity designer: business development being carried out by Business Entity modeling tool, to entity data structure And service logic is modeled;
S7, it establishes JIT generator: the Business Entity model of modeling being generated as to operate in Business Entity operation frame basis On service code, generate logic and only execute primary, operation Shi Weichun when Business Entity model dispose toward formal production environment Service code executes, and eliminates performance consumption caused by the load of Business Entity model, parsing, is greatly improved operation effect Rate;JIT generator according to Business Entity model generate runtime code by Business Entity model generate corresponding Api, Tetra- program bags of Entity, Core and Persistence.
Preferably, entity data structure includes that a root entity and several fructifications (can not have in the step S1 There is fructification);
Entity includes several attributes, the data type to set a property or is set a property as enumeration type or association type; Wherein, data type includes the basic class of character, text, time, date, boolean, integer, floating number and binary type Type;Association type refers to association and current business entity and the Business Entity in addition to current business entity of boss's entity Association.
More preferably, the Business Logic in the step S1 is physical operation layer, linkage meter according to different scene partitionings Calculate rules layer, data check rules layer and service operations layer;
Wherein, physical operation layer is the service logic around solid data example, and physical operation layer is most fine-grained industry Current entity data can be carried out operation modification in physical operation by business logical layer;
Linkage computation rule layer is to be triggered on different opportunitys by internal data variation;Linkage computation rule layer needs are set Setting trigger fields, (i.e. this rule is the modification triggering by which field;The computation rule that links is a kind of service logic, this kind of The execution of rule is not actively triggered by external call;), trigger fields are modified for trigger fields, and trigger fields are current real Field on body or the field in the fructification of current entity;
Data check rules layer (with linkage computation rule) is to be triggered on different opportunitys by internal data variation;Data Verification rules layer needs that trigger fields are arranged;
Service operations layer is the method provided outside, belongs to industry service layer, and service operations layer is responsible for internal each The operation of entity carries out layout execution;
Each Business Logic corresponds to a component description, the corresponding one section of code logic of each component description;Wherein, Component description includes corresponding procedure set, parameter and return value.
Preferably, the Business Entity operation frame in the step S2 is based on microkernel architecture mode, Business Entity Operation frame is divided into inner nuclear layer, Business Entity ccf layer and expansion service-business component layer;
Wherein, inner nuclear layer is basic operation frame layer, and inner nuclear layer provides service logic and develops most basic structure and expansion Exhibition mechanism, such as the control of conflict control, permission, Plugin Mechanism;
Business Entity ccf layer is the inner nuclear layer Business Entity ccf layer that list exploitation is taken out on the basis of inner nuclear layer, Business Entity ccf layer provides the business realizing of list exploitation, such as built-in additions and deletions change and look into operation;
Expansion service-business component layer is to provide expansion service and business component based on Business Entity ccf layer, in addition to Business operation except CRUD is realized in this layer.
More preferably, specific step is as follows for the Business Entity operation frame operation in the step S2:
S201, user's opening operation, it is automatic that change is submitted to collect and be saved in Business Entity operation frame;Wherein, change collection Including newly-increased data change, the change of modification data and data change is deleted, increase data change, the change of modification data newly and deletes number It is both needed to be submitted to data change interface according to change;
Regular component base in S202, Business Entity operation frame, which loads, to be executed and is transmitted to Business Entity operation frame In business operation processor, business operation processor transfer operation rule is programmed into the movement grade cache layer in Cache Framework;
Regular component base in S203, Business Entity operation frame, which loads, to be executed and is transmitted to Business Entity operation frame In Business Entity operation frame, the preservation processor transmission in Business Entity operation frame submits rule to be programmed into Cache Framework In things grade cache layer;
S203, it saves processor construction DB things and DB things is submitted to database;
S204, database load data into session level cache layer, and session level cache layer loads data into things grade cache layer, Things grade cache layer loads data into movement grade cache layer, and simultaneously operation grade cache layer submits data to things grade cache layer, thing Object grade cache layer submits data to session level cache layer.
Preferably, session level cache layer is used to cache in persistent storage (such as database) storage in the step S3 Data;
Transaction-level cache layer is for cache user opening function and during being operated, all data before preservation Variation, is specifically divided into two kinds of situations:
If 1., execute and save operation, the data in transaction-level cache layer can be submitted to persistent storage and data update To session level cache layer;
If 2., execute and cancel operation, the data in transaction-level cache layer will be lost;
The data variation during the primary request of grade cache layer caching is acted, the following two kinds situation is specifically divided into:
If 1., request run succeeded, the data for acting grade cache layer are submitted to transaction-level cache layer;
If 2., request execute failure, the data for acting grade cache layer are rolled back.
Preferably, the increment mechanism in the step S4 includes that increment obtains data module and increment submission data mould Block;
Increment obtains data module and is used to support a variety of dimensions according to entity, attribute and data line according to front end needs Degree cuts returned data, reduces volume of transmitted data;
Increment submits data module to be used for when data are submitted in front end, it is only necessary to submit the data of variation, and not submit All data reduce volume of transmitted data.
Preferably, Business Entity designer includes entity node design module, physical operation design in the step S6 Module, entity linkage computation rule and data check rule design module and service operational design module;
Wherein, entity node design module is for adding, deleting entity node;Correspondent entity node being capable of additions and deletions entity category Property (field) and be arranged field attribute;
Physical operation design module is for providing additions and deletions physical operation method;
Entity linkage computation rule and data check rule design module are used in different opportunity additions and deletions linkage calculating, count According to verification rule;
Service operations design module and are used for additions and deletions service operations.
A kind of Business Entity system based on Domain Driven Design, the system include,
Business Entity model, Business Entity model are abstracted for describing service logic using Domain Driven Design Physical model;Business Entity model includes entity data structure and Business Logic two parts;
Business Entity runs module, and for providing the basic framework of service logic operation, Business Entity operation module includes The public service logic of the most basic content of Business Logic, encapsulation realizes that extension mechanism, business function are using this frame as base Plinth adds customized business logic codes;
Cache module, cache module include that session level cache layer, transaction-level cache layer and movement grade cache layer three-level are slow It deposits, the data of cache business logic different conditions, session level cache layer corresponds to initial data, and things grade caches corresponding Current transaction Grade data, movement and the corresponding current operation grade data of caching, on meeting requirements for access of the business function to different conditions data The access frequency to database is reduced, whole efficiency is improved;
Increment mechanism module, data and preservation for defining the data of front end caller return, front end modification is submitted When to submit to the data of database be incremental data, greatly reduce the transmission quantity of data, improve program feature;
Business Logic, Business Logic include entity logical layer and service logic layer, and entity logical layer is most fine granularity Service logic split layer, service logic layer is used to handle the layout of entity logical layer;
Business Entity designer, for by Business Entity modeling tool carry out business development, to entity data structure with And service logic is modeled;
JIT generator, for the Business Entity model of modeling to be generated as operating on the basis of Business Entity operation frame Service code, generate logic and only execute primary, operation Shi Weichun industry when Business Entity model dispose toward formal production environment Business code executes, and eliminates performance consumption caused by the load of Business Entity model, parsing, is greatly improved operational efficiency; JIT generator according to Business Entity model generate runtime code by Business Entity model generate corresponding Api, Tetra- program bags of Entity, Core and Persistence.
Preferably, the Business Entity operation module includes that local calling acts on behalf of factory and entity object manager, this Ground calls alternative factory's creation is local to call agency, and local call acts on behalf of modulation entity object manager, entity object manager Layout entity object example simultaneously executes entity object manager context, while holding custom action base class;Entity object is real Example, which executes, to be verified regular base class, computation rule base class and executes entity action base class, while holding entity action context, school It tests regular base class and holds verification rules context, computation rule base class holds computation rule context.
Business Entity realization method and system based on Domain Driven Design of the invention has the advantage that
(1), the present invention realizes frame using the Business Logic that Domain Driven Design method abstracts, and includes entity Data and service logic two parts provide normal constraint for service logic exploitation, and by service logic carry out fine granularity fractionation, Layout, the precipitable multiplexing that final realization business is patrolled;In order to promote business development efficiency, the present invention provides solid modelling tools Business development modeling is assisted, and provides JIT engine and is generated as the model built up by modeling tool to adapt to Business Entity The procedure set when operation of frame;
(2), by introducing Business Entity frame, it is based on Domain Driven Design method, field core business logic layer is mentioned For Business Entity model, modeling fractionation is carried out by each characteristic of the Business Entity model to field core business logic layer;It opens Hair personnel only develop the fine-grained service logic of a pile when carrying out service logic exploitation, and these logics are put into business The different positions of physical model adapt to different application scenarios to the logic of field core by providing service operations Layout processing is carried out, such field core logic can settle out;
(3), by Business Entity designer, what user can be convenient carries out modeling developing to Business Logic, is promoted Development efficiency and development period flexibility;
By Business Entity frame, unified Business Logic operation frame and built-in realization are encapsulated, promotes the runtime Stability;
By JIT generator, model when designing is generated as to program when operation, to metadata when eliminating operation Resolving improves runtime efficiency;
By providing the service logics concepts such as entity, physical operation, linkage calculating, data check, service operations, Neng Gouzhi Hold and break up service logic, different application scenarios are adapted to by service operations, realize core business logic stabilization and Precipitable multiplexing;
The characteristics such as obtain and submit by three-level caching, incremental data, reduce interaction with database and application with The data volume of front end transmission, improves overall performance;
(4), the present invention provides a unified frame for the exploitation of field core business logic, enhances development and application program Restraining force, it is ensured that field layer exploitation is compact, and then reduces requirement to developer and mention simultaneously to reduce development cost The stability of the application program of height exploitation and the adaptability for adapting to front end UI variation, are conducive to the steady of service logic layer identification code It is fixed.
Detailed description of the invention
The following further describes the present invention with reference to the drawings.
Attached drawing 1 is the structural block diagram of the Business Entity system based on Domain Driven Design;
Attached drawing 2 is the structural block diagram of Business Entity operation frame;
Attached drawing 3 is change collection structural block diagram;
Attached drawing 4 is the flow diagram that Business Entity runs module operation;
Attached drawing 5 is entity node design interface figure;
Attached drawing 6 is physical operation design interface figure;
Attached drawing 7 is linkage computation rule design interface figure;
Attached drawing 8 is data check rule design interface figure.
Specific embodiment
It is real to a kind of Business Entity based on Domain Driven Design of the invention referring to Figure of description and specific embodiment Existing method and system are described in detail below.
Embodiment 1:
As shown in Fig. 1, the Business Entity implementation method of the invention based on Domain Driven Design, steps are as follows:
S1, Business Entity model is established by Business Entity modeling tool: Business Entity model uses Domain Driven Design The physical model abstracted, for describing service logic;Business Entity model includes entity data structure and Business Logic Two parts;
Wherein, entity data structure includes a root entity and several fructifications (can not have fructification);
Entity includes several attributes, the data type to set a property or is set a property as enumeration type or association type; Wherein, data type includes the basic class of character, text, time, date, boolean, integer, floating number and binary type Type;Association type refers to association and current business entity and the Business Entity in addition to current business entity of boss's entity Association.Business Logic according to different scene partitionings be physical operation layer, linkage computation rule layer, data check rules layer with And service operations layer;Physical operation layer is the service logic around solid data example, and physical operation layer is most fine-grained industry Current entity data can be carried out operation modification in physical operation by business logical layer;The computation rule layer that links is different Opportunity is triggered by internal data variation;Linkage computation rule layer needs to be arranged trigger fields, and (i.e. which field is this rule be by Modification triggering;The computation rule that links is a kind of service logic, and the execution of this kind of rule is not actively touched by external call Hair;), trigger fields are modified for trigger fields, and trigger fields are in the fructification of the field or current entity on current entity Field;The execution of linkage computation rule, was executed on the different opportunitys of data variation, executed opportunity list, see Table 1 for details:
Data check rules layer (with linkage computation rule) is to be triggered on different opportunitys by internal data variation;Data Verification rules layer needs that trigger fields are arranged;On the execution opportunity of data check rule, see Table 2 for details:
Service operations layer is the method provided outside, belongs to industry service layer, and service operations layer is responsible for internal each The operation of entity carries out layout execution;
Each Business Logic corresponds to a component description, the corresponding one section of code logic of each component description;Wherein, Component description includes corresponding procedure set, parameter and return value.
S2, establish Business Entity operation frame: Business Entity operation frame provides the basic framework of service logic operation, industry Entity operation frame includes the most basic content of Business Logic, encapsulates public service logic realization extension mechanism, business Function is to add customized business logic codes based on this frame;Business Entity operation frame is based on microkernel architecture Mode, Business Entity operation frame are divided into inner nuclear layer, Business Entity ccf layer and expansion service-business component layer;Wherein, interior Stratum nucleare is basic operation frame layer, and inner nuclear layer provides service logic and develops most basic structure and extension mechanism, such as conflict control System, permission control, Plugin Mechanism etc.;Business Entity ccf layer is the inner nuclear layer that list exploitation is taken out on the basis of inner nuclear layer Business Entity ccf layer, the business realizing of Business Entity ccf layer offer list exploitation, such as built-in additions and deletions, which change, looks into operation;Expand Exhibition service-business component layer is expansion service and business component to be provided, other than CRUD based on Business Entity ccf layer Business operation is realized in this layer.
As shown in Fig. 2, specific step is as follows for the operation of Business Entity operation frame:
S201, user's opening operation, it is automatic that change is submitted to collect and be saved in Business Entity operation frame;Wherein, such as attached drawing 3 Shown, change collection includes newly-increased data change, the change of modification data and deletes data change, increases data change, modification data newly Change and deletion data change are both needed to be submitted to data change interface;
Regular component base in S202, Business Entity operation frame, which loads, to be executed and is transmitted to Business Entity operation frame In business operation processor, business operation processor transfer operation rule is programmed into the movement grade cache layer in Cache Framework;
Regular component base in S203, Business Entity operation frame, which loads, to be executed and is transmitted to Business Entity operation frame In Business Entity operation frame, the preservation processor transmission in Business Entity operation frame submits rule to be programmed into Cache Framework In things grade cache layer;
S203, it saves processor construction DB things and DB things is submitted to database;
S204, database load data into session level cache layer, and session level cache layer loads data into things grade cache layer, Things grade cache layer loads data into movement grade cache layer, and simultaneously operation grade cache layer submits data to things grade cache layer, thing Object grade cache layer submits data to session level cache layer.
S3, Cache Framework is established in Business Entity operation frame, Cache Framework includes that session level cache layer, transaction-level are slow Deposit layer and movement grade cache layer three-level caching: the data of cache business logic different conditions, session level cache layer correspond to original Data, things grade cache corresponding Current transaction grade data, movement and the corresponding current operation grade data of caching, are meeting business function To the access frequency reduced in the requirements for access of different conditions data to database, whole efficiency is improved;
Wherein, session level cache layer is used to cache the data stored in persistent storage (such as database);
Transaction-level cache layer is for cache user opening function and during being operated, all data before preservation Variation, is specifically divided into two kinds of situations:
If 1., execute and save operation, the data in transaction-level cache layer can be submitted to persistent storage and data update To session level cache layer;
If 2., execute and cancel operation, the data in transaction-level cache layer will be lost;
The data variation during the primary request of grade cache layer caching is acted, the following two kinds situation is specifically divided into:
If 1., request run succeeded, the data for acting grade cache layer are submitted to transaction-level cache layer;
If 2., request execute failure, the data for acting grade cache layer are rolled back.
S4, increment mechanism is established in Business Entity operation frame: the data of front end caller return, front end modification are submitted Data and preservation when to submit to the data of database be incremental data, greatly reduce the transmission quantity of data, promoted Program feature;Increment mechanism includes that increment obtains data module and increment submission data module;Increment obtains data module and uses According to front end needs, support cuts returned data according to a variety of dimensions of entity, attribute and data line, reduces number According to transmission quantity;Increment submits data module to be used for when data are submitted in front end, it is only necessary to submit the data of variation, and not submit All data reduce volume of transmitted data.
S5, service logic is split as to entity logical layer and service logic layer, entity logical layer is most fine-grained business Logic splits layer, and service logic layer is used for the layout to entity logical layer and handles;
S6, it establishes Business Entity designer: business development being carried out by Business Entity modeling tool, to entity data structure And service logic is modeled;Business Entity designer includes entity node design module, physical operation design module, entity Link computation rule and data check rule design module and service operational design module;Wherein, entity node design module is used In addition, delete entity node;Entity node design interface is as shown in Fig. 5;See Table 3 for details for entity node attribute:
Correspondent entity node can additions and deletions entity attribute (field) and be arranged field attribute;See Table 4 for details for field attribute:
Physical operation design module is for providing additions and deletions physical operation method;Physical operation design interface is as shown in Fig. 6; See Table 5 for details for physical operation attribute:
Entity linkage computation rule and data check rule design module are used in different opportunity additions and deletions linkage calculating, count According to verification rule;The computation rule design interface that links is as shown in Fig. 7;Linking, see Table 6 for details for computation rule attribute:
Data check rule design interface is as shown in Fig. 8;See Table 7 for details for data check rules properties:
Service operations design module and are used for additions and deletions service operations, and see Table 8 for details for service operations attribute:
S7, it establishes JIT generator: the Business Entity model of modeling being generated as to operate in Business Entity operation frame basis On service code, generate logic and only execute primary, operation Shi Weichun when Business Entity model dispose toward formal production environment Service code executes, and eliminates performance consumption caused by the load of Business Entity model, parsing, is greatly improved operation effect Rate;JIT generator according to Business Entity model generate runtime code by Business Entity model generate corresponding Api, Tetra- program bags of Entity, Core and Persistence.
Embodiment 2:
Business Entity system based on Domain Driven Design of the invention, the system include Business Entity model, business reality Running body module, cache module, increment mechanism module, Business Logic, Business Entity designer and JIT generator;Business is real Body Model, Business Entity model is for describing service logic, the physical model abstracted using Domain Driven Design;Business is real Body Model includes entity data structure and Business Logic two parts;Business Entity runs module, for providing service logic fortune Capable basic framework, Business Entity operation module include the most basic content of Business Logic, encapsulate public service logic reality Existing extension mechanism, business function are to add customized business logic codes based on this frame;Cache module, cache module It is cached including session level cache layer, transaction-level cache layer and movement grade cache layer three-level, cache business logic different conditions Data, session level cache layer correspond to initial data, and things grade caches corresponding Current transaction grade data, and movement and caching are corresponding current Grade data are operated, the access frequency to database is reduced on meeting requirements for access of the business function to different conditions data, Improve whole efficiency;Increment mechanism module, for define front end caller return data, front end modification submit data with And submitting to the data of database when saving is incremental data, greatly reduces the transmission quantity of data, improves procedural Energy;Business Logic, Business Logic include entity logical layer and service logic layer, and entity logical layer is most fine-grained business Logic splits layer, and service logic layer is used for the layout to entity logical layer and handles;Business Entity designer, for passing through business reality Volume modeling tool carries out business development, models to entity data structure and service logic;JIT generator, for that will build The Business Entity model of mould is generated as operating in the service code on the basis of Business Entity operation frame, generates logic only in business It is executed when physical model is disposed toward formal production environment once, operation Shi Weichun service code executes, and eliminates Business Entity mould Performance consumption caused by type load, parsing, is greatly improved operational efficiency;JIT generator is raw according to Business Entity model One Business Entity model is generated into corresponding tetra- journeys of Api, Entity, Core and Persistence at runtime code Sequence packet.As shown in Fig. 4, Business Entity operation module includes that local calling acts on behalf of factory and entity object manager, local to adjust It creates local call with alternative factory to act on behalf of, local call acts on behalf of modulation entity object manager, entity object manager layout Entity object example simultaneously executes entity object manager context, while holding custom action base class;Entity object example is held Row verifies regular base class, computation rule base class and executes entity action base class, while holding entity action context, verification rule Then base class holds verification rules context, and computation rule base class holds computation rule context.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (10)

1. a kind of Business Entity implementation method based on Domain Driven Design, which is characterized in that steps are as follows:
S1, Business Entity model is established by Business Entity modeling tool: Business Entity model is abstract using Domain Driven Design Physical model out, for describing service logic;Business Entity model includes entity data structure and Business Logic two Point;
S2, establish Business Entity operation frame: Business Entity operation frame provides the basic framework of service logic operation, and business is real Running body frame includes the most basic content of Business Logic, encapsulates public service logic realization extension mechanism;
S3, Cache Framework is established in Business Entity operation frame, Cache Framework includes session level cache layer, transaction-level cache layer And movement grade cache layer three-level caching: the data of cache business logic different conditions, session level cache layer correspond to initial data, Things grade caches corresponding Current transaction grade data, movement and the corresponding current operation grade data of caching, is meeting business function to not With the access frequency reduced in the requirements for access of status data to database, whole efficiency is improved;
S4, increment mechanism is established in Business Entity operation frame: the number of data, front end modification submission that front end caller returns Submitting to the data of database accordingly and when saving is incremental data;
S5, service logic is split as to entity logical layer and service logic layer, entity logical layer is most fine-grained service logic Layer is split, service logic layer is used for the layout to entity logical layer and handles;
S6, establish Business Entity designer: business development carried out by Business Entity modeling tool, to entity data structure and Service logic is modeled;
S7, it establishes JIT generator: the Business Entity model of modeling is generated as operating on the basis of Business Entity operation frame Service code;JIT generator generates a Business Entity model according to Business Entity model generation runtime code corresponding Tetra- program bags of Api, Entity, Core and Persistence.
2. the Business Entity implementation method according to claim 1 based on Domain Driven Design, which is characterized in that the step Entity data structure includes a root entity and several fructifications in rapid S1;
Entity includes several attributes, the data type to set a property or is set a property as enumeration type or association type;Wherein, Data type includes the fundamental type of character, text, time, date, boolean, integer, floating number and binary type;It closes Connection type refers to the association of boss's entity and being associated with for current business entity and the Business Entity in addition to current business entity.
3. the Business Entity implementation method according to claim 1 or 2 based on Domain Driven Design, which is characterized in that institute It is physical operation layer, linkage computation rule layer, data check that the Business Logic in step S1, which is stated, according to different scene partitionings Rules layer and service operations layer;
Wherein, physical operation layer is the service logic around solid data example, and physical operation layer is that most fine-grained business is patrolled Layer is collected, operation modification can be carried out to current entity data in physical operation;
Linkage computation rule layer is to be triggered on different opportunitys by internal data variation;The computation rule layer that links needs that touching is arranged Field is sent out, trigger fields are modified for trigger fields, and trigger fields are the fructification of the field or current entity on current entity On field;
Data check rules layer is to be triggered on different opportunitys by internal data variation;Data check rules layer needs that touching is arranged Send out field;
Service operations layer is the method provided outside, belongs to industry service layer, and service operations layer is responsible for internal each entity Operation carry out layout execution;
Each Business Logic corresponds to a component description, the corresponding one section of code logic of each component description;Wherein, component Description includes corresponding procedure set, parameter and return value.
4. the Business Entity implementation method according to claim 1 based on Domain Driven Design, which is characterized in that the step Business Entity operation frame in rapid S2 is based on microkernel architecture mode, and Business Entity operation frame is divided into inner nuclear layer, business Solid framework layer and expansion service-business component layer;
Wherein, inner nuclear layer is basic operation frame layer, and inner nuclear layer provides service logic and develops most basic structure and striking machine System;
Business Entity ccf layer is the inner nuclear layer Business Entity ccf layer that list exploitation is taken out on the basis of inner nuclear layer, business Solid framework layer provides the business realizing of list exploitation;
Expansion service-business component layer is to provide expansion service and business component based on Business Entity ccf layer.
5. the Business Entity implementation method according to claim 1 or 4 based on Domain Driven Design, which is characterized in that institute State in step S2 Business Entity operation frame operation specific step is as follows:
S201, user's opening operation, it is automatic that change is submitted to collect and be saved in Business Entity operation frame;Wherein, change collection includes Newly-increased data change, the change of modification data and deletion data change increase data change newly, modification data change and delete data and become It is more both needed to be submitted to data change interface;
Regular component base in S202, Business Entity operation frame, which loads, to be executed and is transmitted in Business Entity operation frame Business operation processor, business operation processor transfer operation rule are programmed into the movement grade cache layer in Cache Framework;
Regular component base in S203, Business Entity operation frame, which loads, to be executed and is transmitted in Business Entity operation frame Business Entity operation frame, the preservation processor transmission in Business Entity operation frame submit rule to be programmed into Cache Framework Things grade cache layer;
S203, it saves processor construction DB things and DB things is submitted to database;
S204, database load data into session level cache layer, and session level cache layer loads data into things grade cache layer, things Grade cache layer loads data into movement grade cache layer, and simultaneously operation grade cache layer submits data to things grade cache layer, things grade Cache layer submits data to session level cache layer.
6. the Business Entity implementation method according to claim 1 based on Domain Driven Design, which is characterized in that the step Session level cache layer is for caching the data stored in persistent storage in rapid S3;
For cache user opening function and during being operated, all data before preservation become transaction-level cache layer Change, be specifically divided into two kinds of situations:
If 1., execute and save operation, the data in transaction-level cache layer can be submitted to persistent storage and data update is attended the meeting Talk about grade cache layer;
If 2., execute and cancel operation, the data in transaction-level cache layer will be lost;
The data variation during the primary request of grade cache layer caching is acted, the following two kinds situation is specifically divided into:
If 1., request run succeeded, the data for acting grade cache layer are submitted to transaction-level cache layer;
If 2., request execute failure, the data for acting grade cache layer are rolled back.
7. the Business Entity implementation method according to claim 1 based on Domain Driven Design, which is characterized in that the step Increment mechanism in rapid S4 includes that increment obtains data module and increment submission data module;
Increment obtains data module and is used to support a variety of dimensions pair according to entity, attribute and data line according to front end needs Returned data is cut, and volume of transmitted data is reduced;
Increment submits data module to be used for when data are submitted in front end, it is only necessary to submit the data of variation, and not submit all Data reduce volume of transmitted data.
8. the Business Entity implementation method according to claim 1 based on Domain Driven Design, which is characterized in that the step In rapid S6 Business Entity designer include entity node design module, physical operation design module, entity linkage computation rule and Data check rule designs module and service operational design module;
Wherein, entity node design module is for adding, deleting entity node;Correspondent entity node can additions and deletions entity attribute with And the attribute of setting field;
Physical operation design module is for providing additions and deletions physical operation method;
Entity linkage computation rule and data check rule design module are used in different opportunity additions and deletions linkage calculating, data school Test rule;
Service operations design module and are used for additions and deletions service operations.
9. a kind of Business Entity system based on Domain Driven Design, which is characterized in that the system includes,
Business Entity model, Business Entity model is for describing service logic, the entity abstracted using Domain Driven Design Model;Business Entity model includes entity data structure and Business Logic two parts;
Business Entity runs module, and for providing the basic framework of service logic operation, it includes business that Business Entity, which runs module, The public service logic of the most basic content of logical layer, encapsulation realizes extension mechanism;
Cache module, cache module include session level cache layer, transaction-level cache layer and movement grade cache layer three-level caching, are delayed The data of service logic different conditions are deposited, session level cache layer corresponds to initial data, and things grade caches corresponding Current transaction series According to movement and the corresponding current operation grade data of caching reduce on meeting requirements for access of the business function to different conditions data To the access frequency of database, whole efficiency is improved;
Increment mechanism module mentions when for defining the data of front end caller return, the data and preservation that front end modification is submitted The data for giving database are incremental data;
Business Logic, Business Logic include entity logical layer and service logic layer, and entity logical layer is most fine-grained industry Logic of being engaged in splits layer, and service logic layer is used for the layout to entity logical layer and handles;
Business Entity designer, for carrying out business development by Business Entity modeling tool, to entity data structure and industry Business logic is modeled;
JIT generator, the industry for being generated as operating in by the Business Entity model of modeling on the basis of Business Entity operation frame Business code;JIT generator generates a Business Entity model according to Business Entity model generation runtime code corresponding Tetra- program bags of Api, Entity, Core and Persistence.
10. the Business Entity system according to claim 9 based on Domain Driven Design, which is characterized in that the business Entity operation module includes that local calling acts on behalf of factory and entity object manager, local to call alternative factory's creation is local to call Agency, local call act on behalf of modulation entity object manager, and entity object manager layout entity object example simultaneously executes entity Object Manager context, while holding custom action base class;Entity object example, which executes, verifies regular base class, computation rule Base class and execution entity action base class, while holding entity action context, it verifies regular base class and holds verification rule or more Text, computation rule base class hold computation rule context.
CN201910192561.9A 2019-03-14 2019-03-14 Business entity implementation method and system based on domain-driven design Active CN109947422B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910192561.9A CN109947422B (en) 2019-03-14 2019-03-14 Business entity implementation method and system based on domain-driven design

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910192561.9A CN109947422B (en) 2019-03-14 2019-03-14 Business entity implementation method and system based on domain-driven design

Publications (2)

Publication Number Publication Date
CN109947422A true CN109947422A (en) 2019-06-28
CN109947422B CN109947422B (en) 2022-03-15

Family

ID=67009812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910192561.9A Active CN109947422B (en) 2019-03-14 2019-03-14 Business entity implementation method and system based on domain-driven design

Country Status (1)

Country Link
CN (1) CN109947422B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111091213A (en) * 2019-11-28 2020-05-01 泰康保险集团股份有限公司 Product data processing method and device, electronic equipment and computer readable medium
CN111666073A (en) * 2020-06-12 2020-09-15 远光软件股份有限公司 Graphical model construction method and device based on domain-driven design
CN111666355A (en) * 2020-06-12 2020-09-15 远光软件股份有限公司 Model construction method and device for three-layer model of field, data and scene
CN111984240A (en) * 2020-06-29 2020-11-24 山东浪潮通软信息科技有限公司 Method and device for expanding public service logic of domain entity
CN111984257A (en) * 2020-06-29 2020-11-24 山东浪潮通软信息科技有限公司 Solid modeling customized extension method and device
CN112051996A (en) * 2020-08-18 2020-12-08 远光软件股份有限公司 Modeling method and device based on development platform element unified naming dictionary
CN113204329A (en) * 2021-03-19 2021-08-03 浙江华云信息科技有限公司 Control method for driving business application by unified data model and application system thereof
CN113253983A (en) * 2021-05-14 2021-08-13 上海理工大学 Modeling method and system for discrete industry network collaborative manufacturing platform based on drive design

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750145A (en) * 2012-06-05 2012-10-24 怯肇乾 Network system software system framework and implementation method thereof
CN108073393A (en) * 2018-01-18 2018-05-25 山东浪潮通软信息科技有限公司 A kind of storage design method based on EF frames
US20180276273A1 (en) * 2017-03-23 2018-09-27 International Business Machines Corporation Interactive Dialog in Natural Language Using an Ontology

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750145A (en) * 2012-06-05 2012-10-24 怯肇乾 Network system software system framework and implementation method thereof
US20180276273A1 (en) * 2017-03-23 2018-09-27 International Business Machines Corporation Interactive Dialog in Natural Language Using an Ontology
CN108073393A (en) * 2018-01-18 2018-05-25 山东浪潮通软信息科技有限公司 A kind of storage design method based on EF frames

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李引,袁峰: ""基于领域驱动设计的应用系统模型"", 《计算机工程与应用》 *

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111091213A (en) * 2019-11-28 2020-05-01 泰康保险集团股份有限公司 Product data processing method and device, electronic equipment and computer readable medium
CN111666355B (en) * 2020-06-12 2023-09-08 远光软件股份有限公司 Model construction method and device for field, data and scene three-layer model
CN111666073A (en) * 2020-06-12 2020-09-15 远光软件股份有限公司 Graphical model construction method and device based on domain-driven design
CN111666355A (en) * 2020-06-12 2020-09-15 远光软件股份有限公司 Model construction method and device for three-layer model of field, data and scene
CN111666073B (en) * 2020-06-12 2023-09-29 远光软件股份有限公司 Graphical model construction method and device based on field driving design
CN111984240A (en) * 2020-06-29 2020-11-24 山东浪潮通软信息科技有限公司 Method and device for expanding public service logic of domain entity
CN111984257B (en) * 2020-06-29 2022-07-08 浪潮通用软件有限公司 Solid modeling customized extension method and device
CN111984257A (en) * 2020-06-29 2020-11-24 山东浪潮通软信息科技有限公司 Solid modeling customized extension method and device
CN112051996A (en) * 2020-08-18 2020-12-08 远光软件股份有限公司 Modeling method and device based on development platform element unified naming dictionary
CN112051996B (en) * 2020-08-18 2023-09-29 远光软件股份有限公司 Modeling method and device based on development platform element unified naming dictionary
CN113204329A (en) * 2021-03-19 2021-08-03 浙江华云信息科技有限公司 Control method for driving business application by unified data model and application system thereof
CN113253983A (en) * 2021-05-14 2021-08-13 上海理工大学 Modeling method and system for discrete industry network collaborative manufacturing platform based on drive design
CN113253983B (en) * 2021-05-14 2024-04-02 上海理工大学 Discrete industry network collaborative manufacturing platform modeling method and system based on drive design

Also Published As

Publication number Publication date
CN109947422B (en) 2022-03-15

Similar Documents

Publication Publication Date Title
CN109947422A (en) A kind of Business Entity realization method and system based on Domain Driven Design
CN110989983B (en) Zero-coding application software rapid construction system
CN104408222B (en) Reconfiguration method of real-time distributed simulation platform
CN103383645B (en) Code generating method and system
CN103365646B (en) Form user-defined, logical definition and processing method based on script engine
CN102024204B (en) Constructing method of reliability design analysis service system of service oriented architecture
CN106095942A (en) Strong variable extracting method and device
CN101131744A (en) Method and system for implementing automatic adaptation of data object model
CN105138802A (en) Intelligent design system and method for gun barrel
CN105447051A (en) Database operation method and device
CN107256144A (en) Front and back code automatic generation method, terminal and computer-readable recording medium
CN105204863A (en) Technical documentation for law violation data auditing system
CN109034403A (en) A kind of urban rail transit equipment skeleton
KR20220160518A (en) Access method and device, electronic equipment and computer storage medium
CN110221815B (en) Automatic generation method of control software model based on ontology
CN103020382A (en) BOM-based multi-instance polymerization simulation modeling method
CN111176658B (en) Automatic conversion method from AADL (architecture analysis and design language) to Simulink model based on meta-object mechanism
CN103699746B (en) CADDS5 piping three-dimensional design method based on data base and system
CN110865942B (en) Model rule checking method of comprehensive modular avionics system
CN104765688A (en) Verification system for Java program runtime capable of deploying rules dynamically
JP2007535013A (en) Computer program design
CN111125996A (en) Method for realizing instruction set based on bidirectional constraint tree of pseudo-random excitation generator
CN109669671A (en) Multi-level self-adaptive method based on micro-service
CN104699472A (en) Method for solving contradiction between frequent changes in business process and software maintenance by adopting rule engine
CN103049301A (en) Multi-instance aggregation simulation modeling system on basis of BOM (basic object model)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant