i try to write a generator or i want to write all stored procedures(SP) in C# side. how 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?
views:
94answers:
3There 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
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:
or you could also use a commercial code generators such as CodeSmith and its available templates for CRUD stored procedure generation.
I don’t quite understand your question, but if you are looking for information how to build your own code generator inside VS Environment you’ve to be familiar with Addins and Extensions, is not that complicated, is just a little bit different than a regular app, but if you are looking for an Addin that allows you auto generate store procedures from Visual Studio, take a look on CodeHelper, it does that, and a lot more, by selecting tables you can create store procedures for (SELECT, INSERT, UPDATE) automatically from VS Environment, is pretty easy to use
Here are some functionalities:
-Store procedure and SQL Statetments generator from tables
-Entity Class generator from tables
-Encapsulate one or multiples fields into properties
-Methods for insert/update/delete records
-Backup for Solution and projects
-and many others
take a look (bluemusa.com)