ASP.NET Custom ObjectDataSource
I suppose it would be debatable, but I would venture to suggest that with the ObjectDataSource, ASP.NET has caught up with, and surpassed Windows Forms in terms of databinding. Unfortunately, it has one major problem that makes it incompatible with many O/R mappers: It only supports default (parameter-less) constructors.
The solution? Why make your own DataSource of course! While I looked into this briefly, the MSDN documentation is mostly from a usage perspective. It does little to describe how the base DataSource and DataSourceView classes work. Recently I found a fantastic blog post by Manuel Abadia that does a great job of explaining their interaction, and exactly what needs to be done to create your own ObjectDataSource. Using his advice, I was able to create a version of the ObjectDataSource that can call a constructor, and pass it pertinent parameters (like primary key information). This simple change allows the ObjectDataSource to work flawlessly with most code generated by O/R mappers!

If you like, you can download the custom ObjectDataSource, and example code.
Hopefully this code will save you as much time as it has saved me!
- Brent
Attachment(s): ObjDataSource.zip