ASP.NET v2.0: ObjectDataSource and ObjectSpaces

ASP.NET v2.0 has several datasource controls that allow you to declare all of your database access code when using the new GridView and other controls.  One of the coolest versions of this is the ObjectDataSource control which lets you easily declare the name of a class and a method that will return a collection of bindable of objects -- not your usual DataSet or DataReader:

<asp:gridview id="CategoriesGrid" runat="server"
    datasourceid="CategoriesDS" />
<asp:objectdatasource id="CategoriesDS" runat="server"
    typename="BusObjects" selectmethod="GetCategories" />

I've hooked this concept up to a class that uses ObjectSpaces against the Northwind database to have an ASP.NET page that not only has no code in it, but there is also no SQL or stored procedure!  Declarative GUI and declarative database, with just a few simple classes and trivial code to get ObjectSpaces to hook it all together.  You could also use generics with this control.

No Comments