Automatically create C# wrapper classes around stored procedures

后端 未结 6 2149
面向向阳花
面向向阳花 2021-02-06 09:51

I\'ve inherited a rather large application that really could use some cleanup. There is data access code littered throughout the application. In code behinds, some in business l

6条回答
  •  清酒与你
    2021-02-06 10:15

    Similar to Robert's suggestion, we've written our own version of Code Smith.

    Our "Code Generator" has two parts: SQL & Classes.

    SQL: Will generate the Update, Select & Delete stored procs.

    C#: Will generate the classes and save the file as a .cs

    We call: sp_MShelpcolumns 'tablename' to get a list of fields and data types and then do a replace.

    Its not a perfect solution, but is very effective to getting the first 80% completed

提交回复
热议问题