开发者

How to make a Generator for Stored procedure?

i try to write a generator or i want to write all stored procedures(SP) in C# side. ho开发者_如何学Pythonw can i do that?

1) writing a sp generator OR

2) Coding all sps via C# OR

3) Writing All data process (SP) via Linq

which one is best or your advise?


You can create a generator yourself, all in C# - if you search on CodeProject you'll find quite a few articles and code samples (some quite old and outdated, however).

But you might also benefit from code generation techniques, such as T4 (Text Templating Transformation Toolkit) which is part of VS2008 and VS2010 and one of Microsoft's best kept secrets :-)

Check out:

  • How to use T4 to generate CRUD stored procedures
  • T4 templates for stored procedures

or you could also use a commercial code generators such as CodeSmith and its available templates for CRUD stored procedure generation.


if you have table and columns informations then you can develop a sp generator for sql server.

Your start point must be below queries;

SELECT * FROM INFORMATION_SCHEMA.TABLES --get table information
SELECT * FROM INFORMATION_SCHEMA.COLUMNS --get table column information


There is AutoSproc from MS. Your mileage may vary etc.

Links etc here in my answer to TSQL - Parse Execution Plan to determine columns to be returned by a stored procedure

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜