Gamma 2b

Rating: No reviews yet
Downloads: 88
Released: Dec 23, 2008
Updated: Dec 23, 2008 by willrawls
Dev status: Stable Help Icon

Recommended Download

Source Code xlgGamma2b.zip
source code, 3784K, uploaded Dec 23, 2008 - 62 downloads

Other Available Downloads

Documentation Release Notes - Gamma 2b
documentation, 12K, uploaded Dec 23, 2008 - 26 downloads

Release Notes

Gamma 2 is mostly just a clean up.
I'd recommend creating C:\data\code\xlg and getting the trunk to that folder.
If you put it somewhere else, let me know if anything breaks and what you did to correct it.

Then you can run the actual code generator "XLG Pipeliner" by running the shortcut:
C:\data\code\xlg\MetX\XLG Pipeliner.lnk

Or directly by running the Debug version of XLG Pipeliner at:
C:\data\code\xlg\bin\xlgPipeliner.exe

Create a new xlgs file (xlg settings file defining a series of code generation steps)
Click "Add Step" and enter the name of the connection you wish to generate a DAL for.
Note that the name you enter will become both the namespace for the entire DAL and the connectionString's "key" attribute from the web/app config.
By default it will assume you want to do a SqlClient gen, but you can change that after the step is added (there's a dropdown that controls what kind of meta data is being walked).
There are 6 providers. 3 data providers (SqlClient, Sybase.Data, and MySql.Data), and 3 "gather" providers.
All 3 data providers work, but if you're using a different version of one of the drivers you'll need to recompile the appropriate provider project with your updated driver.
The PowerShell gather provider isn't working right now (not coded except stubbed out).
The command line gather provider works great, but I need to do some more work on the interface to make it more intuitive.
Output goes to a new folder with the same name as the database connection key as a sub folder typically in
C:\data\code\xlg\DAL\

Once you're ready, click "Gen" and off it goes. If all goes well, you'll wind up with a compilable C# project in the DAL sub folder you selected and can begin exploring the layer of code generated for you. Each table and each index get objects and there is currently no built in support for relationship mapping. Technically it can be done with just a (significant) change to the C# DALXSL template.

----------------------------------

Ok, so now you can open the generated project and compile. Note that when you Gen or Regen all the .Glove.cs files are overwritten. However, the csproj file will only be created once, so if you make changes to the project, they will NOT be overwritten (see the XSL template to see the custom xsl function(s) that make this possible as it's a taste of things to come).

So, let's say you've got a database connection named "FRED" and in that database you have a table name "People" with columns: FirstName, LastName, Address, City, State, Zip, DateCreated, DateModified, Comment.

You'll wind up with the FRED namespace a People object (with one property per column), a PeopleCollection object, and a fair number of static methods delivering a wide variety of functionality.

For instance, assuming all the columns in the People table are individually indexed (what I call uber indexing), then you can load all People records in New York with this line of code:

FRED.PeopleCollection NewYorkers = Fred.People.Index.State.Select("NY");

People.Index is a static object with one static sub object per table index (including multi-column indexes).

Modifying the first new yorker is as simple as:

FRED.People CurrItem = NewYorkers0;
CurrItem.Comment = "Very easy";

At this point you can either save the record at the record or collection of record level with either

CurrItem.Save()
Or
NewYorkers.SaveIfChanged()

As its name implies SaveIfChanged() only saves records with at least one value changed.

I've written the templates so that if the table has a DateCreated and/or a DateModified date/time field then those values will authomatically be populated and maintained for you.
Likewise, if there's a CreatedBy and/or a ModifiedBy field, they will be automatically maintained with the value passed to any of the Save(UserName) or SaveIfChanged(UserName) methods.

See release notes for more information

Reviews for this release

No reviews yet for this release.