Template for Stored Procedures

Template for Stored Procedures

Old forum URL: forums.lhotka.net/forums/t/851.aspx


thilker posted on Wednesday, August 09, 2006

Hi!

Great work!

The only thing I'm missing is a template to create the stored procedures that fit the generated BOs.
I found a template in the codesmith scheme "DatabaseSchema". It is quite ok, but not perfect.

Greetings!

Thorsten


rasupit replied on Thursday, August 10, 2006

Thorsten,

I was planning to add stored procedure template but I have not able to spend time on this.  This summer, It has been a struggle for me to choose between working on template and golf or other outdoor activities.  It very hard to pass on the latter Surprise [:O]

I think modifying an existing will be the quickest approach.  In fact, I think I'll do this and hopefully include this on the next release.

Ricky.

Jaans replied on Sunday, August 27, 2006

Gents

I've modified the StoredProcedure template that is included with CodeSmith a little bit. Hopefully this can be a starting point for tweaking it further. I would like to upload it (perhaps make it part of the CSLA Contrib. on CodePlex) so that the community can help improve it further.

So far it generates stored procedures with the same naming convention as that which CSLA Template 0.9.5 currently generates ("Add<TableName>";"Get<TableName(Plural)>"; etc). I have also made some crude but fast changes so that when a table has an identity column (or GUID) that the stored procedure that is generated, uses the "New" prefix (as per the CSLA template). I hope this helps you out a bit.

How do we make this part of the CSLA contributions on CodePlex ?

Thanks!

JTWebMan replied on Tuesday, August 29, 2006

You can ask Rocky to have him add you as a Developer on the project. Or if you want you can email me them to me and I can put them up for you. jtwebman ( at ) gmail ( dot ) com

I was thinking of putting them in the CodeGenTemplates/CodeSmith/CSLA20/StoreProc Folder.

Does that sound ok with everyone?

JT

Jaans replied on Tuesday, August 29, 2006

Great thanks ! Big Smile [:D] Sounds good to me...

I'll drop you an email with the template.

Regards

Jaans

JTWebMan replied on Tuesday, August 29, 2006

I added this to the source control but it does work in CodeSmith 2.6.

---------------- Compile started -----------------

(551,2): error CS0246: The type or namespace name 'FileDialog' could not be found (are you missing a using directive or an assembly reference?)

Build complete -- 1 errors, 0 warnings

---------------------- Done ----------------------

Build failed

JT

jstevens replied on Friday, September 01, 2006

Hi All,

I see that the CSLAExpress VB templates generate stored procedures as well - Is anyone using these?  Or maybe take a look at them and collaborate on some ideals?

Thanx!

Julian

djjlewis replied on Friday, September 01, 2006

I started using the CSLA Express VB templates last week, as I only had CodeSmith 2.6 at the time and the other set didn't work with it (they have been fixed now though).

On the whole the templates are very good, and as you have noticed generate stored procedures based on the CSLA model plus a few other niceties such as error code checking etc.

You can also opt to use SQL Transactions and it will modify the sprocs accordingly (although I haven't tested these).

There is a bug in the current release regarding concurrency checking but I have been in touch with the author, wcm777, and I believe he is going to upload some fixes into CodePlex.

The CSLA business objects that are generated are very similar to the book and based on 2.0.2. All the logic and template output is stored in the CSLAExpress20.vb file, and it is very easy to open up and debug directly in Visual Studio (the VS project is included with the templates).

At the moment I think there are good bits to both sets of templates (split-base and xml file support in one, sprocs and good seperation in the other etc) so I think I will probably end up combining the best of both worlds, at least for my own needs...

Regards,

Dan.

chiefy81 replied on Tuesday, November 07, 2006

Did you ever complete those stored procedure templates?  Right now im struggling with loading the child elements in the nested fashion that CSLA is expecting, only because its so manual.  For example when the child element gets the datareader from the parent, my stored procedures generated dont have the child data in them.  Any ideas for a solution that involves code generation?


figuerres replied on Friday, August 25, 2006

thilker:
Hi!

Great work!

The only thing I'm missing is a template to create the stored procedures that fit the generated BOs.
I found a template in the codesmith scheme "DatabaseSchema". It is quite ok, but not perfect.

Greetings!

Thorsten


 

Yah I have been hacking thru that ....

 

I may put together my edits and share them soon....

I have modified the proc_names and how a few columns are managed

also took some of the code from the tracker sample app and added it to the template

I am working thru generating some BO classes now so I can see if my Proc's and BO's match up and work w/o major problems :-)

Rob @ Fluent replied on Monday, October 23, 2006

Hi there Thorsten

Did the stored procedure template get uploaded anywhere?

I don't seem to be able to find it on CSLAContrib.

Kind regards

 

Rob

david.wendelken replied on Wednesday, November 01, 2006

I really like the CSLA framework, but the naming convention used in the sample application for stored procedure names is not one of them.

The format is "Add<ThingName>", "Update<ThingName>", etc.

I prefer "<ThingName>Add", "<ThingName>Update", etc.

That way, when I look in the database at the list of procedures, I see all the <ThingName> procedures sorted together.  It makes it much easier to notice if I forgot one (or intentionally didn't create one).

jervit replied on Monday, November 06, 2006

Hi,

Do you have any idea why am I getting this error in CodeSmith 2.6 when I open the .cst file?

---------------- Compile started -----------------

(448,8): error CS0117: 'SchemaExplorer.TableSchema' does not contain a definition for 'HasPrimaryKey'
(472,5): error CS0162: Unreachable code detected

Build complete -- 1 errors, 1 warnings

---------------------- Done ----------------------

Build failed

Thanks!

LeeB replied on Saturday, December 16, 2006

Is there a resolution to this problem (post 8840)?  I am having the same problem.

chiefy81 replied on Monday, November 27, 2006

Are there any updates here?  I am having a serious problem finding a template that will allow me to generated the nested BO stored procedure style that CSLA is looking for.  Any help is much appreciated.  What is everyone using, tool wise, template wise, etc to generate these stored procedures?

Mike


Copyright (c) Marimer LLC