A little before and right after the Tampa CodeCamp I took about 10 days off to do some work around the house as well as hang with the kids at the beach, so I am a bit late with this post regarding the Tampa CodeCamp.
I posted my Tampa CodeCamp presentation slides on the Web Client Software Factory on the PnPGuidance Website. The sample code showing off the WCSF with Enteprise Library is there, too.
I received a question via email about the value of the ObjectContainerDataSource Control in my example. The ObjectContainerDataSource Control is a custom DataSource Control provided by the Patterns & Practices Team in the WCSF that is Model-View-Presenter Friendly.
If you think about the ObjectDataSource Control that is provided in System.Web, it requires and calls a type typically in the business logic layer that implements select, insert, update, and delete methods. When implementing Model-View-Presenter, however, you want the View to delegate events to the Presenter Class where it will respond to any UI events. The ObjectContainerDataSource Control makes this possible by publishing events that can then be easily delegated to the Presenter Class.
Here are some code snippets from the sample code available for download mentioned above:
protected void Page_Init(object sender, EventArgs e)
{
// CustomerDataSource is an ObjectContainerDataSource
CustomerDataSource.Inserted += new EventHandler(CustomerDataSource_Inserted);
}
void CustomerDataSource_Inserted(object sender, ObjectContainerDataSourceStatusEventArgs e)
{
_presenter.OnInsert((Customer) e.Instance);
}
Notice how you can just subscribe to the insert, update, delete, and select events of the ObjectContainerDataSource Control and then pass those events to the Presenter Class. This is a lot more Model-View-Presenter Friendly than your normal ObjectDataSource Control. Note that passing the Customer Instance to the Presenter in the OnInsert Method is purely optional. Most people prefer that the Presenter Class request the Customer Instance separately.
Just thinking out loud here, but I wonder if the Patterns & Practices Team can do something that gives us a Model-View-Presenter Friendly LinqDataSource Control as well. Hmm....