tags:

views:

23

answers:

1

I work with a ASP.NET UI framework that pulls fields for a particular screen off a database. These fields can be associated with particular data fields in another database for binding. The idea with this setup is that if a client needs a new column on a table, they can easily add it, and create a UI field that binds to it without any sort of application restart or recompile.

The problem I've always had with this is that it has meant I'm always having to work with untyped datasets in my code. Are there any ORM libraries for .NET out there that could easily accommodate the requirement of being able to access arbitrary columns in the table schema over and above ones mapped to strongly typed fields?

+1  A: 

This looks interesting:

MicroORM - A Dynamically Typed ORM for VB and C#
http://www.infoq.com/articles/MicroORM

The author needed a way to handle datasets returned from stored procedures, where the number of columns returned can vary.

Most ORM's generate a horrendous amount of boilerplate code to mimic the tables in an object-oriented way. Dynamic binding in C# 4.0 allows you to defer resolution of the class members to runtime, so all that boilerplate code is no longer required.

Robert Harvey
Interesting, unfortunately we won't be moving to .NET 4 for awhile. What I am looking for is more along the lines of something that will allow me to work with strongly typed fields in custom code (since any changes to the schema that would change those fields would require a recompile anyways), while allowing the raw data to be passed into the UI framework for binding. It isn't so much about ORM, as having a strongly typed data model in the application. I've tried strongly typed DataSets, but I can't get them to pull the full schema, only the initial schema pulled into the designer.
You are going to need something like `Reflection.Emit` to generate the necessary classes dynamically. It's not for the faint-hearted.
Robert Harvey