CN108052549A - A kind of method that source data is automatically converted to entity category code - Google Patents
A kind of method that source data is automatically converted to entity category code Download PDFInfo
- Publication number
- CN108052549A CN108052549A CN201711209844.7A CN201711209844A CN108052549A CN 108052549 A CN108052549 A CN 108052549A CN 201711209844 A CN201711209844 A CN 201711209844A CN 108052549 A CN108052549 A CN 108052549A
- Authority
- CN
- China
- Prior art keywords
- data
- source data
- database
- entity
- category code
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/258—Data format conversion from or to a database
Abstract
The invention discloses a kind of methods that source data is automatically converted to entity category code, selected data store internal data content one-to-one corresponding is converted to entity category code by this method by connecting local data base, and it is stored among specified path, during so that source data being converted to entity category code progress project development by programmer, there is the mapping entity category code of one-to-one relationship without compiling manually with database table structure, and the entity category code accuracy compiled is up to absolutely, it is effectively reduced the difficulty to subsequent software exploitation, reduce software development time and cost while easy to operate.
Description
Technical field
The present invention relates to a kind of conversion methods of electronic data format, belong to computer software fields.
Background technology
Database can come tissue, storage and management data according to data structure, can carry out complicated, huge data processing,
Under some specific database development patterns, programmer needs to write has reflecting for one-to-one relationship with database table structure
Entity category code is penetrated, but database is often there are a tables of data up to a hundred, and the multiple fields of the usual intension of tables of data, data are numerous
It is more, and programmer can only compile out corresponding entity class source code manually by every data of correspondence database, write
It is easy to appear the situation that program is caused to malfunction due to wrong typewriting mother is when error in journey, even and if the program of the place specialty of mistake
Member also is difficult to be found, and generates great difficulty to subsequent software exploitation, adds development time and cost.
The content of the invention
For overcome the deficiencies in the prior art, the present invention provides a kind of versatile, easy to operate that source data is automatic
The method for being converted to entity category code.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of method that source data is automatically converted to entity category code, this method are as follows:
Step 1:Connect database
The data type of source data, the position of host machine of database, database-name, username and password are set, according to clothes
Business device address, port and username and password connection database, the table structural information of reading database;
Step 2:Target file attributes are set
NameSpace, major key field and the read only field for the entity class code file to be generated are set;
Step 3:Target selection
Select correspondent entity category code to be generated tables of data or Data View as converting source data;
Step 4:Code building
Selected converting source data is read in the database and carries out data conversion, according to the table structure of converting source data, is regarded
Figure and data content one-to-one corresponding are converted to entity category code, and are stored among specified path.
The data type of the setting source data of the step (1) include Microsoft SQL Server, Access,
Excel and Oracle, the position of host machine are the IP address or domain name where source data, and the user and password are respectively to deposit
Put the database user name and password of source data.
The NameSpace of the step (2) for generation entity class code file belonging to NameSpace, the read-only word
Section is the data needed in the entity class code file of generation labeled as only being read by database, and the major key is the entity of generation
The field for being is marked in category code file.
The data conversion process of the step 4 is as follows:
(1), the database structure structure class file of converting source data is read, according to the database table information of converting source data
Entity class file is generated, the title of entity class file is generated according to the database table title of converting source data, according to conversion source number
According to database table column name generation entity class file variable name and Property Name.
(2), read converting source data residing for data Table Properties, obtain tables of data in arrange initial value, title, sequence number,
The field informations such as size and the precision of column data, decimal digits, type go forward side by side row information parsing.
(3), disconnected after adding field information in entity class file with database, export the path of entity class file
It is successfully prompted with converting.
The beneficial effects of the invention are as follows:The present invention is by connecting local data base by selected data store internal data content
One-to-one corresponding is converted to entity category code, and is stored among specified path so that source data is converted to entity class by programmer
When code carries out project development, the mapping entity without compiling manually with database table structure has one-to-one relationship passes through company
Local data base category code is connect, and the entity category code accuracy compiled is effectively reduced up to absolutely to subsequent software
The difficulty of exploitation, reduces software development time and cost while easy to operate.
Specific embodiment
A kind of method that source data is automatically converted to entity category code, this method be based on Windows systems,
Microsoft Excel office softwares, Microsoft.NET Framework4.0 system environments, Visual Studio 2017
It develops software and database switching software is realized, the database switching software develops software by Visual Studio 2017
It compiles, the project that the database switching software includes has database setting option, class file properties settings and conversion source
Data item, the data lab setting include data type, position of host machine, database-name, user and password, the data type
Item is provided with Microsoft SQL Server data options, Access, Excel data options, Oracle data options sum numbers
According to storehouse connectivity option, the class file properties settings are provided with NameSpace, read only field and major key, the converting source data
Item is provided with code building item, and this method includes such as next four steps as follows:
Step 1:Connect database
The data type of source data, the position of host machine of database, database-name, username and password are set, according to clothes
Business device address, port and username and password connection database, the table structural information of reading database, the position of host machine are
IP address or domain name where source data, the user and password are respectively to store the database user name of source data and close
Code;
Step 2:Target file attributes are set
NameSpace, major key field and the read only field for the entity class code file to be generated, the NameSpace are set
For the NameSpace belonging to the entity class code file of generation, the read only field needs in the entity class code file for generation
Labeled as the data only read by database, the major key is to be marked in the entity class code file of generation
Field;
Step 3:Target selection
Select correspondent entity category code to be generated tables of data or Data View as converting source data;
Step 4:Code building
Selected converting source data is read in the database and carries out data conversion, according to the table structure of converting source data, is regarded
Figure and data content one-to-one corresponding are converted to entity category code, and are stored among specified path.
The data conversion process of the step 4 is as follows:
(1), the database structure structure class file of converting source data is read, according to the database table information of converting source data
Entity class file is generated, the title of entity class file is generated according to the database table title of converting source data, according to conversion source number
According to database table column name generation entity class file variable name and Property Name.
(2), read converting source data residing for data Table Properties, obtain tables of data in arrange initial value, title, sequence number,
The field informations such as size and the precision of column data, decimal digits, type go forward side by side row information parsing.
(3), disconnected after adding field information in entity class file with database, export the path of entity class file
It is successfully prompted with converting.
The database switching software source code of the present embodiment is as follows:
Selected data store internal data content one-to-one corresponding is converted to entity by the present invention by connecting local data base
Category code, and be stored among specified path so that when source data is converted to entity category code progress project development by programmer,
There is the mapping entity of one-to-one relationship by being connected local data base category code with database table structure without compiling manually,
And the entity category code accuracy compiled reaches the difficulty absolutely, being effectively reduced to subsequent software exploitation, easy to operate
While reduce software development time and cost.
Above embodiment cannot limit the protection domain of the invention, and the personnel of professional skill field are not departing from
In the case of the invention general idea, the impartial modification and variation done still fall within the scope that the invention is covered
Within.
Claims (4)
- A kind of 1. method that source data is automatically converted to entity category code, it is characterised in that this method is as follows:(1):Connect databaseThe data type of source data, the position of host machine of database, database-name, username and password are set, according to server Address, port and username and password connection database, the table structural information of reading database;(2):Target file attributes are setNameSpace, major key field and the read only field for the entity class code file to be generated are set;(3):Target selectionSelect correspondent entity category code to be generated tables of data or Data View as converting source data;(4):Code buildingRead selected converting source data in the database and carry out data conversion, according to the table structure of converting source data, view and Data content one-to-one corresponding is converted to entity category code, and is stored among specified path.
- 2. the method according to claim 1 that source data is automatically converted to entity category code, it is characterised in that the step Suddenly(1)The data type of setting source data include Microsoft SQL Server, Access, Excel and Oracle, The position of host machine is the IP address or domain name where source data, and the user and password are respectively the data for storing source data Storehouse username and password.
- 3. the method according to claim 1 that source data is automatically converted to entity category code, it is characterised in that the step Suddenly(2)NameSpace for generation entity class code file belonging to NameSpace, the read only field for generation entity It is needed in category code file labeled as the data only read by database, the major key is the entity class code file acceptance of the bid of generation It is denoted as the field of database key.
- 4. the method according to claim 1 that source data is automatically converted to entity category code, it is characterised in that the step Suddenly(4)Data conversion process it is as follows:(1), read converting source data database structure structure class file, according to the database table information of converting source data generate Entity class file generates the title of entity class file according to the database table title of converting source data, according to converting source data Database table column name generates the variable name and Property Name of entity class file;(2), read converting source data residing for data Table Properties, obtain tables of data in arrange initial value, title, sequence number, size And the field informations such as precision, decimal digits, type of column data go forward side by side row information parsing;(3), in entity class file add field information after disconnected with database, export entity class file path and turn Change work(prompting into.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711209844.7A CN108052549A (en) | 2017-11-27 | 2017-11-27 | A kind of method that source data is automatically converted to entity category code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711209844.7A CN108052549A (en) | 2017-11-27 | 2017-11-27 | A kind of method that source data is automatically converted to entity category code |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108052549A true CN108052549A (en) | 2018-05-18 |
Family
ID=62120642
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711209844.7A Pending CN108052549A (en) | 2017-11-27 | 2017-11-27 | A kind of method that source data is automatically converted to entity category code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108052549A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112764728A (en) * | 2020-12-31 | 2021-05-07 | 北京谊安医疗系统股份有限公司 | Automatic programming method and system suitable for embedded software of breathing machine |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012174767A1 (en) * | 2011-06-20 | 2012-12-27 | 中兴通讯股份有限公司 | Implementation method and device for orm structure-based high efficiency database access |
CN103226478A (en) * | 2013-05-22 | 2013-07-31 | 北京金和软件股份有限公司 | Method for automatically generating and using code |
CN103412749A (en) * | 2013-07-29 | 2013-11-27 | 福建联迪商用设备有限公司 | Relational database based code generation method and code generator |
CN105389339A (en) * | 2015-10-20 | 2016-03-09 | 咸亨国际(杭州)物联网信息产业有限公司 | Tool for rapid generation of database sql statement and entity class |
CN105677323A (en) * | 2015-12-31 | 2016-06-15 | 合肥大多数信息科技有限公司 | Method for automatically generating database operation layer codes |
CN105677324A (en) * | 2015-12-31 | 2016-06-15 | 合肥大多数信息科技有限公司 | Method for automatically generating entity type codes |
-
2017
- 2017-11-27 CN CN201711209844.7A patent/CN108052549A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012174767A1 (en) * | 2011-06-20 | 2012-12-27 | 中兴通讯股份有限公司 | Implementation method and device for orm structure-based high efficiency database access |
CN103226478A (en) * | 2013-05-22 | 2013-07-31 | 北京金和软件股份有限公司 | Method for automatically generating and using code |
CN103412749A (en) * | 2013-07-29 | 2013-11-27 | 福建联迪商用设备有限公司 | Relational database based code generation method and code generator |
CN105389339A (en) * | 2015-10-20 | 2016-03-09 | 咸亨国际(杭州)物联网信息产业有限公司 | Tool for rapid generation of database sql statement and entity class |
CN105677323A (en) * | 2015-12-31 | 2016-06-15 | 合肥大多数信息科技有限公司 | Method for automatically generating database operation layer codes |
CN105677324A (en) * | 2015-12-31 | 2016-06-15 | 合肥大多数信息科技有限公司 | Method for automatically generating entity type codes |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112764728A (en) * | 2020-12-31 | 2021-05-07 | 北京谊安医疗系统股份有限公司 | Automatic programming method and system suitable for embedded software of breathing machine |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9600507B2 (en) | Index structure for a relational database table | |
CN104778540B (en) | A kind of equipment for building materiaIs manufacturing BOM management method and management system | |
CN102541521B (en) | Automatic operating instruction generating device based on structured query language and method | |
CN107368346A (en) | A kind of code generating method and device based on metadata and script engine | |
CN103631969A (en) | Generation method and device of report data | |
CN101499162A (en) | Medical research data management system and method | |
WO2008109562A1 (en) | Systems and methods for modeling partitioned tables as logical indexes | |
CN109933571A (en) | Database design documentation generation method, device and computer readable storage medium | |
CN108388623B (en) | ER relationship generation method and device, computer equipment and storage medium | |
CN102024046A (en) | Data repeatability checking method and device as well as system | |
CN109635300A (en) | Data verification method and device | |
CN105701251A (en) | Data export and import method based on object definition | |
CN108052549A (en) | A kind of method that source data is automatically converted to entity category code | |
CN106294128A (en) | A kind of automated testing method deriving report data and device | |
CN101122978A (en) | Contract risk transferring system and method | |
CN112799655A (en) | Multi-type code automatic generation method, device and medium based on pre-training | |
CN113407565A (en) | Cross-database data query method, device and equipment | |
CN112817592A (en) | Automatic code generation method based on entity annotation | |
CN104965917B (en) | Industrial real-time data base interface method | |
Goble | Structured systems analysis through Prolog | |
RU2020113119A (en) | Method for providing a software tool and a data processing system | |
CN112463896B (en) | Archive catalogue data processing method, archive catalogue data processing device, computing equipment and storage medium | |
JP2022101477A (en) | Transaction processing method of ethereum virtual machine, device, apparatus, and medium | |
JP6287506B2 (en) | Database access control program, database access control method, and information processing apparatus | |
CN112416305A (en) | Rapid development method based on visual studio |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180518 |