Archive for November, 2010


Wednesday, November 10th, 2010

So, I’ve been using the basic version of CodeSmith’s Generator product and have mixed feelings about the .netTiers template. It apparently does not like uniqueidentifier fields marked as ROWGUID.

Frankly, I’ve been doing LINQ to SQL for long enough now that I am getting really juiced about using the PLINQO framework with CodeSmith.

The thing is, I love the L2S syntax, but do NOT love using VS-generated DBML files for everything, and Entity Framework sucks.

What’s a brother to do? Hand-code data-context-aware data entities? <sarcasm>Tempting, but no, thanks!</sarcasm>


PLINQO project layout screenEnter PLINQO, a framework that represents your data-aware entities in clear form, with partial classes you’ll need to extend them. The class structure allows for easy detachment from the entities’ data contexts so that you can pass your entities off to your presentation layers and they update the database directly, obviating the need for expensive-to-maintain custom data transfer objects.

PLINQO is built into the Professional Edition of the CodeSmith toolset, which is a template-driven source code generation application, in such a manner that you can generate the framework code automagically straight from your database. What’s coolest of all is that you can re-gen your entities from the database at any time, without it touching your custom code.

I have used the PLINQO’s code generated during my trial period for CodeSmith professional, but now that has lapsed, and I miss it dearly.  In the meantime, I am maintaining the framework code previously generated by hand. Kind of blows, but when I get my new dev studio setup at the home office, I will be getting all manner of new tools, and CodeSmith is one of them.

Using the code is a snap, and being able to integrate the classes out-of-the-box took me from database to business logic in one easy step. Granted, you still have to encode some data rules, but having all the basics in place ready to go meant that I was able to take some sketched out requirements, bang out the basic database structure and got me a data access layer right out of the box.

The PLINQO template can also configure your project to use PLINQO with Data Services and Window Communication Foundation (WCF), though I have yet to grok that.

Its integration into Visual Studio is also godsend, allowing you to update objects without having to leave your dev environment.

One item that makes it worth the price of admission though, is the Enum generator, which takes your look up tables (e.g. Product Types, Scanner Settings, etc.) and creates the Enum class for you. OMFG, I’ve been dying for this for years.

Anyway, take a quick look at the Solution Explorer to the right here. It shows a quick overview of how the PLINQO framework looks when generated by the PLINQO template in CodeSmith.

I am moving into using the ASP.NET MVC framework and want to focus on that, not on the data-access-layer.

The google’s code repository is where the PLINQO sample project Tracker is hosted.


This framework has already saved me many hours coding and debugging code for data access, code which is so boring I want to gouge my eyeballs out with pencil. The Visual Studio integration is what LINQ to SQL could have been had Microsoft not dropped the ball in favor of that pig of a beast EF4. Detachable entities and Enum objects round out a top-shelf solution, and those are just what I have grokked so far.