首页 | 本学科首页   官方微博 | 高级检索  
     

基于模板的.Net三层架构的代码自动生成
引用本文:刘于新,姚凯学,许道云. 基于模板的.Net三层架构的代码自动生成[J]. 微机发展, 2012, 0(8): 13-16
作者姓名:刘于新  姚凯学  许道云
作者单位:贵州大学计算机科学与信息学院,贵州贵阳550025
基金项目:贵阳市2010年重大科技专项项目([2010]筑科工合同字第6-01号)
摘    要:三层架构是数据库开发中最常用的分层架构。三层结构能够提高代码重用率,降低项目开发难度。为了解决手工编写三层架构的代码工作量大且容易出错的问题,使用.Net平台提供的动态编译和反射技术,设计并实现了基于可定制模板的自动代码生成器。该代码生成器利用三层架构的代码依赖数据库的架构信息这一特点,以数据库架构信息、Xml配置文件和模板文件作为输入,输出三层架构的各层代码。用户可以修改Xml配置文件的内容和使用该代码生成器提供的模板语言定制、修改自己的模板文件,方便、灵活地控制输出的目标代码。代码生成器的使用在实际的项目开发中具有重要的意义。

关 键 词:自动代码生成  三层架构  可定制模板  元数据  内置模板

Automatic Code Generation Based on Template on. Net Framework of Three Layers Architecture
LIU Yu-xin,YAO Kai-xue,XU Dao-yun. Automatic Code Generation Based on Template on. Net Framework of Three Layers Architecture[J]. Microcomputer Development, 2012, 0(8): 13-16
Authors:LIU Yu-xin  YAO Kai-xue  XU Dao-yun
Affiliation:( College of Computer Science and Information, Guizhou University, Guiyang 550025, China )
Abstract:Three layers architecture is the most commonly used layered structure in database development. Three layers structure can im- prove code reuse rate and reduce the difficulty of project development. In order to solve the problem that manual programming code of three layers architecture is a big workload and easy to make mistake, using dynamic compile and reflecting technique provided by the. Net platform designs and realizes the automatic code generator that based on the customizable template. The code generator uses this feature that the code of three layers structure relies on the structure of the database information. Taking database schema information,Xml config- uration flies and template files as input, the code generator produces the code of three layers architecture as output. Users can change the content of the Xml configuration files, and can customize, modify their own template files by using template language provided by the code generator,conveniently and flexibly controlling the output of the object code. In practical project development the use of code gener- ator is of great significance.
Keywords:automatic code generation  three layers architecture  customizable template  metadata  built-in template
本文献已被 维普 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号