Repository Factory Out

The P&P group has been listening to developers, and they've decoupled the Data Access Guidance Package from the WSSF etc. It really should have been available on its own from the git-go. The full source is available at codeplex.com here, and its called "Repository Factory".

You need to be careful, though. They haven't produced a simple MSI Installer for this, even though the setup project is included in the downloadable "final" source code - so you'll need to build it. I have no idea why they do this, but hey- let's not look a gift horse, you know?

The other issue is a bit more fragile - the "Final Source Code" download that was available today at the upper right link on the page did not build for me. I fiddled with missing references for at least 20 minutes, and no-go. Finally, I went to the Source Code section and downloaded the most recent checked in build, number 10107 - and that one built in Release mode without a hitch. Also, you'll need to have both the GAT and the GAX installed. You can get the July drops of these from the links on-site, or if you have the January builds those should also work.

Now - what's so cool about this? Well, you can start any project, and enable the Guidance Package for Repository Factory (once you've installed the built MSI from the setup project in the solution) -- and you can specify a connection, project responsibilities, build your sprocs, your business entities, and Repository Factories, all nicely integrated with the Enterprise Library 3.1.

So for example, if I generate "stuff" for the Northwind Products table, all I need to do to get all products looks like so:

ProductsRepository rep = new ProductsRepository("Northwind");
List<Products> prods=rep.GetAllFromProducts();
this.dataGridView1.DataSource = prods;

Don't like Enterprise Library? No problem. David Hayden, an MVP here in FL who seems to have made a career around EntLib and the P&P / GAT stuff, shows how you can decouple the whole thing from Ent Lib and use SqlHelper - or any other DAAB that you already have.

If you aren't inclined to download and install all the prerequisites, or to attempt to build the MSI installer, I've cached a copy of it in my Windows Live SkyDrive public folder here. Help Yourself! (UPDATE: 10/3/2007 - they now have an MSI installer at codeplex.)

Incidentally, if you are having trouble uninstalling earlier versions of the Guidance Automation Toolkit (GAT) or the Guidance Automation Extensions (GAX), especially on Windows Vista, please don't drive yourself nuts trying to follow the incredibly sadistic lists of "Stuff" that so - called experts tell you that you have to do. Just download the MSICUU (Windows Installer Cleanup Utility). Once installed, you can run this from your Start menu, find the offending installed products that "won't uninstall" - and remove all traces of them in the Registry. The newer versions should then install perfectly. Whole thing takes about 10 seconds to fix.

I can dig it. When I used the WSSF with this in it, it just got overly complex. But now, I can produce a BLL and DAL layer that my finicky clients will approve, and know that it will be not only "best practices" -- but consistent and maintainable too.

Comments

Popular posts from this blog

FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX

Some observations on Script Callbacks, "AJAX", "ATLAS" "AHAB" and where it's all going.

IE7 - Vista: "Internet Explorer has stopped Working"