Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Database wrapper / stored procedure call generator

I need a good tool to generate C# code to call stored procedures in SQL Server in a typesafe manner, and to automatically generate simple stored procs (Delete, Insert, Update given a table and a primary key)

Anybody out there with experience in the area?  Commercial and free tools both accepted...

The Dotnet User
Tuesday, April 12, 2005

I think CodeSmith might be what you're looking for.

http://www.ericjsmith.net/codesmith/overview.aspx

Joe Paradise
Tuesday, April 12, 2005

I've also had good luck with Resharper as a template-building tool.  Doesn't have database connectivity, so you'd have to do some typing, but it's a good product overall.

http://www.jetbrains.com/resharper/

moron
Tuesday, April 12, 2005

LLBLGEN

Sassy
Tuesday, April 12, 2005

+1 for Codesmith -- I'm about a year into it with no major complaints (a few nagging annoyances that are easy to live with though)

Sgt.Sausage
Wednesday, April 13, 2005

CodeSmith, many famous projects make use of it. Excellent way to save time.

Li-fan Chen
Wednesday, April 13, 2005

Which "famous" projects are you referring to ?

Joel Spolsky
Wednesday, April 13, 2005

+1 for LLBLGen

Colm O'Connor
Wednesday, April 13, 2005

I think the last American Idol winner was generated with CodeSmith.

Perhaps she is not that famous?

Jason Watts
Thursday, April 14, 2005

This is something you could write in a weekend if you really wanted to....I did about 2 years ago and have been using it ever since.

You can use the Command objects parameters collection to generate any code you want.

TJ
Thursday, April 14, 2005

I actually did write something like it.  Not in a weekend, probably in a week...  The idea is, it's rather limited so I was looking for fully automated stuff.

Generic template-driven generation works for me only if the "work with database" part is very well developed.  Otherwise, for my personal purposes my own tool is probably a better fit.

Seems that there is no specialized generator like this on the market...

The Dotnet User
Friday, April 15, 2005

So you are looking for something to generate stored procedures and the C# code to consume them right?

All of the meta data is there for you, you just need to access it. Things like primary keys are either available in the .Net ADO objects or in the database schema tables.

TJ
Friday, April 15, 2005

If you do write your own, the task may be simplified if you don't use stored procs: http://weblogs.asp.net/dreilly/archive/2005/03/30/396251.aspx

John Rusk
Saturday, April 16, 2005

Oh boy....Good old Sproc vs SQL debate

TJ
Tuesday, April 19, 2005

*  Recent Topics

*  Fog Creek Home