惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
N
Netflix TechBlog - Medium
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
B
Blog
F
Fortinet All Blogs
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
Google Developers Blog
A
About on SuperTechFans
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
B
Blog RSS Feed

博客园 - Gordon Golden Shining

who am I inside of me STGenerator Released ObjectDataSource的Add-In Asp.net page lifecycle explain in msdn 我做的代码生成的工具的思路 (支持.NET2.0) Programming Haskell in Visual Studio.net 2003 C#/VB.Net converter A good book to read A possible way for testing threading/server application a break in .net 2.0 remoting WinXP sp2 and win 2003 does break com+/System.Transaction 2.0 You have to read this New tools box for year 2005 Recommend: IOC container must read article dynamic proxy how to How to implement AOP in .net My Wishlist for .net development some common used tips in web development No refresh dropdownlist using xmlhttp callback
All about codes generation
Gordon Golden Shining · 2005-08-27 · via 博客园 - Gordon Golden Shining

I would  reckon any one who is interested  in the code gneration,  goes to www.codegeneration.net first, not check the  available tools, but the interview with many code generation tools authors. They talk about what situation they met to use code generation successfully, and the weakness and strength.

IMHO, every developer should know how to develop the code generation tools yourself, rather than use the available commerical tools, because only you as the author who can simply customize your own tools to match your secnairo, and most of the enterprise database application will be a special case need your own customize...Also, don't expect the code gneration to generate the whole application, it is still not in reality.

There is an intervew in the web site with Dave thomas (author of the pramatic programmers), he mentioned he acutally uses ruby a lot to do the code generation work, which can be much simpler than C# or java.

How to make a code generation? There are mostly three ways...
1. RegEx, using regular expression to do the string match and replace
2. Xml as the template and XSLT to convert the variables
3. XDoclet in Java or C# attribute
4. Template engine like NVelocity or stringtemplate, freemarker (java)

I think template is the easiest and manaable way to write your own codes template.
eg as stringtemplate,
you need to create a templat first,

sqlinsert() ::= <<
Insert into $tablefields, sperate=","$
values ($values,seperte=","$)
>>

then write a c# controller class to assign your table schema information to the template
stringtemplate.setattriubte("tablefields", "field1");
stringtemplate.setattriubte("tablefields", "field2");
...