Automatically create C# wrapper classes around stored procedures

后端 未结 6 2165
面向向阳花
面向向阳花 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:38

    dragging and dropping the stored procedures onto a dataset design surface (in .net 2.0 and higher) generates a wrapping function

    but if you have a lot of them to do, you might be better off using or writing a simple code generator

    two options for this:

    1. generate the wrapping code yourself as C# classes/methods
    2. generate a dataset.xsd file then open it in visual studio and let the designer generate the classes/methods for you

    the latter can be maintained via the dataset design surface, but may be tricky to get generated right (the first time)

提交回复
热议问题