Unix Technical Forum

Standards for using Stored Procedures as an interface

This is a discussion on Standards for using Stored Procedures as an interface within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I've been tasked by a client to come up with documentation on standards to follow in creating a ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-20-2008, 06:14 PM
Thomas R. Hummel
 
Posts: n/a
Default Standards for using Stored Procedures as an interface

Hi,

I've been tasked by a client to come up with documentation on
standards to follow in creating a data access layer implemented
through stored procedures. When talking about a data access layer,
they mean what will be interfacing with the .NET DAL. Upper
management, and the general consensus here is to stay away from a
strictly CRUD-based, auto-generated set of stored procedures.

In my own design work, I've identified some places to abstract out
entities that aren't based strictly in one table. I'm not sure how to
put that thought process into a more generic document though. How to
decide when to abstract, etc.

My question is, does anyone know of any good references or similar
documents that I could use as a starter to make sure that I don't
leave out any major areas that need to be addressed? All of my
searches come up with DALs that are strictly written from the point of
view of the .NET developer.

Thanks,
-Tom.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-20-2008, 06:14 PM
Eric Isaacs
 
Posts: n/a
Default Re: Standards for using Stored Procedures as an interface


The CRUD-based auto-generated set of stored procedures is a great
basis if you have a matching middle-tier. I would suggest coming up
with a middle-tier architecture that's generic (so that it can be auto-
generated) and flexible so that custom code can also be added to it.

If you have normalized databases, mimicking the structure of the
normalized tables in the middle-tier just makes sense. Every table
has a collection and an associated class including cross-reference
tables. For one to many relationships (parent to child relationships)
the parent class will have a collection of children within it, but
also the child class will have a parent property. By doing this, you
have the option of filling it from the top down or the bottom up.

The middle-tier is there as an interface to the database and as the
keeper of the business logic. But how you fill that middle-tier from
the database can be dynamic or customized.

With our generic auto-generated middle-tier design, we're able to fill
multiple layers (classes and collections) with just 1 to a few SQL
calls. We can even create custom fillers if the need arises, but now
we're coming up with new ways to fill our middle tier components with
generic SQL that's working nearly as efficiently as the custom fillers
(that take a lot more time to develop.) All in all, we're saving a
lot of development time now with our middle-tier design and that
design is making every developers code much more predictable and easy
to follow.

You'll still need to write custom code in the middle-tier, but if you
separate your generated generic code in separate partial class files,
you can focus your code development on just the more complicated
development that's business specific and you can regenerate the middle-
tier and associated auto-generated sprocs when database changes are
made.

There are ways to make this work. Doing it all by hand just doesn't
make sense anymore.

We all make a living out of automating processes, but software
development is going in the same direction. We're able to automate a
large portion of it now with custom scripts that are written as if our
own developers wrote the code entirely themselves. Also the generated
code will just work with very limited testing required, once you get
it right the first time which saves time in testing as well.

Look into CodeSmith as a tool to consider. Some of the templates
available for CodeSmith online will get you started on the right
path. You can customize your own scripts for generating your own code
to your own standards. Even if you only generate a small portion of
the code or the sprocs, a tool such as CodeSmith will pay for itself
very quickly. But you'll still need good developers to architect your
standards.

-Eric Isaacs
J Street Technology, Inc.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: Standards for using Stored Procedures as an interface

Thread Thread Starter Forum Replies Last Post
REVIEW: "Information Security Policies, Procedures, and Standards",Thomas R. Peltier InfoSec News Attrition Infosec News 0 07-01-2008 09:20 AM
standards & methods to write stored procedures San LUC Sybase 0 04-08-2008 03:47 PM
Oracle Stored Procedures VERSUS SQL Server Stored Procedures jrefactors@hotmail.com SQL Server 11 02-29-2008 09:22 AM
SQL Stored Procedures X Java Stored Procedures in DB2 8.2 Rafael Faria DB2 3 02-27-2008 04:48 AM
Oracle Stored Procedures VERSUS SQL Server Stored Procedures jrefactors@hotmail.com Oracle Database 11 02-24-2008 03:49 PM


All times are GMT. The time now is 04:45 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com