Freigeben über


Peter Blum’s new blog and his cool new data source controls

Peter Blum has been well known is the ASP.NET world for many years for writing a whole suite of powerful controls, which you can read all about on his site.  One thing that was missing on Peter’s resume is that he never had a blog.  Well he started one earlier this month, and is making up for the lost time in a big way, with already 11 posts!  And we’re not talking about small posts that just point to other people’s stuff (unlike this post I suppose!), but real with useful meaty content.  Make sure you check out his blog at https://weblogs.asp.net/peterblum/.  I hope he keeps the good stuff coming!

In particular, Peter has been working hard on some interesting data source controls that work with Visual Studio 2010.  He’s calling them the ‘Versatile DataSources’, and is making it all available for free on CodePlex.

The following posts on his blog describe the data source controls:

The simplest way to try out his controls is to download them from CodePlex.  The package contains a rich set of samples that you can directly run and play with.  You’ll need VS2010 Beta 2 to run this, so if you don’t already have it, get it from here.

I haven’t fully tried everything yet, but the one I played with the most is his POCODataSource, which is quite interesting.  The core idea is very simple: you give it a type and it makes it easy to put up a WebForms UI to fill up an instance of that type.  The UI supports full validation using standard model annotations supported by Dynamic Data.

The beauty is that it’s really quite easy to use.  The data source declaration looks something like this (borrowed from Peter’s samples):

    <poco:POCODataSource ID="POCODataSource1" runat="server" POCOTypeName="CEOEmailGenerator" />

 

For the actual UI, you can use any standard ASP.NET data control like DetailsView, FormView or some similar 3rd party control.  Then when an Update operation happens, you simply access the built instance from the data source using  POCODataSource1.POCOInstance.  At that point, you can do whatever you want with it.  In Peter’s sample, he ends up calling an action method directly on the object, e.g.

 protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) {
   if (Page.IsValid) {
      ((CEOEmailGenerator)POCODataSource1.POCOInstance).Send();
   }
}

But I don’t see anything that ties you to this pattern, and you could instead just call some helper method and pass the object if your object doesn’t have an action method itself.

Anyway, check it out in much more details on Peter’s blog!

Comments

  • Anonymous
    December 01, 2009
    Dear Mr. Peter Blum, Is there a way to get technical documentation about the Dynamic Data Architecture? What I am trying to get is a complete knowledge of "what" and "where" to touch in the whole Dynamic Data core templates as to create your own site using such technology but pretending to put it into real life production. Maybe you remember the way in which you usually debugged applications in VS 2003. You knew where to go, where to put a check point, understand behavior and change things accordingly. With Dynamic Data you just really can't follow as you wish because there are so many undocumented syntax and issues that apparently only those involved in developing the product know. It is a little frustrating not finding a single book about it (I already bought the 34 pages Dynamic Data of Craig Shoemaker but it really doesn't help much in this area) On the other side, blogs and forums are full of a lot of tips and routines but at the end you get a little frustrated because there are too much “disordered” feedback and sometimes it seems that you could find a much better simple solutions if you had understood first the basic principle of all of this. Pardon my English; I’m a Salvadoran Spanish speaker. Carlos Porras (El Salvador)

  • Anonymous
    December 03, 2009
    @Carlos: I'm David Ebbo, not Peter Blum. I was just writing about Peter's blog in this post :) We actually have quite a bit of conceptual documentation on MSDN (http://msdn.microsoft.com/en-us/library/cc488545.aspx), and you may want to look at that. The forum is a great place to ask specific questions if you run into issues.