AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

Template to generate sp for Views #647

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Could you please share with us a template generating SQL Server stored 
procedures from both the tables and views of the selected source database? That 
would be the existing 
Samples\v6.0\Templates\Database\StoredProcedures\AllStoredProcedures.cst with 
the addition of Views.

Thanks,

Vadym

Original issue reported on code.google.com by vadym.fo...@gmail.com on 1 May 2012 at 7:17

GoogleCodeExporter commented 9 years ago
What kind of stored procedures would you want to generate from a view?

Original comment by bniemyjski on 1 May 2012 at 8:01

GoogleCodeExporter commented 9 years ago
At the very minimum, three kinds:

--Get_List to select all rows
--Get to perform dynamic search and provide paging support
--Find to perform parameterized search

I'm attaching a SQL script with a Northwind example to illustrate. Please let 
me know if you need more info.

Thanks,

Vadym

Original comment by vadym.fo...@gmail.com on 1 May 2012 at 8:22

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the script. I've accepted this issue and we will consider adding 
this in a future release.

One could modify the current templates to generate off a SchemaObjectBase 
object instead of TableSchema, this is the base class for tables and views. 
Next, one would need to change the ColumnSchema types to DataObjectBase as this 
is the base type for both ViewColumnSchema and ColumnSchema. 

Original comment by bniemyjski on 3 May 2012 at 2:21