Wednesday, November 14, 2007 4:18 PM
The StormFactory Quickstart
Until I can produce more detailed documentation, here is a brief "Quickstart" explaining what StormFactory does and how to use it. Also keep an eye on the StormFactory web site at for more information...
http://www.stormfactory.net
StormFactory is a stored-procedure oriented object-relational mapping tool for SQL Server and C#. Using a SELECT procedure, it will generate an entity class, a data-access class which facilitates CRUD operations and encapsulates a generic collection of the entity, and a stored procedure that is structured to receive entity instances or collections and insert or update them as appropriate. Though this is its first alpha release and as such you should expect it to be a bit buggy, the tool is solid enough for several developers to use on a daily basis.
Like anything else in life, the more information that goes in, the more desirable your results will be. That said, you should be able to do a basic initial run-through of StormFactory in about 5 minutes. Really. Here's how:
Step 1: Use the Connection Chooser to connect to a server & database of your choosing; the best choice would be one with a good number of garden-variety SELECT procedures to pick from.
Step 2: Use the "Get Procedures" button to fetch back a list of stored procedures from the chosen database:
Step 3: Pick a SELECT procedure from the list (don't try picking an INSERT or UPDATE proc; you
will get an exception) and click "Interrogate Procedure." This will (a) inspect the procedure and get a list of input & output parameters, (b) populate the "Procedure Details" grid with details about all the result columns returned by the procedure, and (c) prepare the "SQL Parameters" grid with all the details needed to assign values to the procedure's input parameters and execute it:
Step 4: You're ready to generate! Normally you would set more values in order to control the output more precisely, but for now just pick a name for your entity, make sure your "Save Directory" is set to what you want (see upper left corner of the startup form), and click "Create Class." This will generate your entity, data-access class, and insert/update procedure:
At this point you're done generating your first domain object. Congratulations! Have a look at the generated code to see what's going on.
Coming soon... there are a few design patterns behind the code that StormFactory generates, so the next article here will describe the generated code, the patterns behind it, and how it can make your life easier.