ObjectContainerDataSource VS ObjectDataSource

Topics: Web Client Software Factory
Aug 17, 2007 at 6:22 PM
What are the differences between the ObjectContainerDataSource and the ObjectDataSource? Is it possible to use the ODS within WCSF? Does OCDS have functionality that is being directly utilized by WCSF?

I'm trying to figure out if the ObjectContainerDataSource is absolutely necessary and whether I can switch it to an ObjectDataSource. I have alot of instances where a control can work properly with the ODS but not with the OCDS.

Can the ODS use the List collections that are normally generated within WCSF?

Thanks.
Aug 17, 2007 at 7:39 PM
Edited Aug 17, 2007 at 7:40 PM
Hi!

I recommend to you that you read the following WCSF’ Documentation topic about the ObjectContainerDataSource control and his difference with the ObjectDataSource control:

  • How to: Use the ObjectContainerDataSource Control (Developing Web Client Applications -> How to: Use the ObjectContainerDataSource Control)


The Web Client Software Factory reference implementation uses the View-Presenter pattern. In this pattern, the presenter contains the logic to respond to user events (such as updating or retrieving data) and manipulates the state of the view. The Web Client Software Factory contains the data source control ObjectContainerDataSource. This control implements data binding in a way that easily integrates with the View-Presenter pattern.


Hope it helps!

Sebastian Iacomuzzi
http://staff.southworks.net/blogs/siacomuzzi
Aug 17, 2007 at 8:11 PM
Hi,

I am also facing problem with OCDS when I use it with Infragistics grid. I am using List collections generated by WCSF with infragistics grid. Ultrawebgrid has its own events for insert/update/delete . Am I missing anything by not using OCDS?

Thank you,

Ramesh


plstovall wrote:
What are the differences between the ObjectContainerDataSource and the ObjectDataSource? Is it possible to use the ODS within WCSF? Does OCDS have functionality that is being directly utilized by WCSF?

I'm trying to figure out if the ObjectContainerDataSource is absolutely necessary and whether I can switch it to an ObjectDataSource. I have alot of instances where a control can work properly with the ODS but not with the OCDS.

Can the ODS use the List collections that are normally generated within WCSF?

Thanks.


Feb 29, 2008 at 5:00 AM
Hi,

Why ObjectContainerDataSource?

--> for strictrly following MVP.

--> Why not we use ObjectDataSource or SqlDataSource?
ObjectDataSource = it binds up with Custom object or Business entiy some where in Middle tier. which we don' want.
SqlDataSource = when you do onSelecting,OnInserting,OnUpdating etc. events it fires to sql server.

-->where our Hero-ObjectContainerDataSource fires the event OnSelecting,OnInserting,OnUpdating event on thise event a page can
register a Presnter method here for the operations.


That' why we use ObjectContainerDataSource..

if Some one has more views to share pls do it

Regards,
Kiran
Feb 29, 2008 at 5:50 AM


klpatil wrote:
Hi,

Why ObjectContainerDataSource?

--> for strictrly following MVP.

--> Why not we use ObjectDataSource or SqlDataSource?
ObjectDataSource = it binds up with Custom object or Business entiy some where in Middle tier. which we don' want.
SqlDataSource = when you do onSelecting,OnInserting,OnUpdating etc. events it fires to sql server.

-->where our Hero-ObjectContainerDataSource fires the event OnSelecting,OnInserting,OnUpdating event on thise event a page can
register a Presnter method here for the operations.


That' why we use ObjectContainerDataSource..

if Some one has more views to share pls do it

Regards,
Kiran


Well said.
We wrote ObjectContainerDataSource to get around not being able to unit test any code that uses ObjectDataSource. Since we try to do TDD (or Example Driven Development, as I like to call it), this was a challenge.
This new data source allowed us to easily unit test our views that bound to a data object. Look at the Electonic Funds Transfer RI for some code that was TDDed using this data source.

Michael Puleio - patterns & practices
Webhttp://msdn.microsoft.com/practices/
Bloghttp://blogs.msdn.com/mpuleio/
Mar 27, 2008 at 1:19 PM
Hi,

I can't find an example for the OnInserting event and I don't get any values in the e.NewValues. Any suggestions?

Br, Christoffer
Mar 27, 2008 at 2:37 PM
Edited Mar 27, 2008 at 2:37 PM


syggen wrote:
Hi,

I can't find an example for the OnInserting event and I don't get any values in the e.NewValues. Any suggestions?

Br, Christoffer


Hi syggen,

If you'll go to the Web client Software Factory - Feburary 2008 menu option and install the Composite Web Client Library Source Code Install feature you will find an ObjectContainerDataSource QuickStart that will provide you an excellent example for CRUD.
Mar 27, 2008 at 3:06 PM

BillKrat wrote:


syggen wrote:
Hi,

I can't find an example for the OnInserting event and I don't get any values in the e.NewValues. Any suggestions?

Br, Christoffer


Hi syggen,

If you'll go to the Web client Software Factory - Feburary 2008 menu option and install the Composite Web Client Library Source Code Install feature you will find an ObjectContainerDataSource QuickStart that will provide you an excellent example for CRUD.



Hi BillKrat,

Thank you for your reply but I must be blind :(. I can't find the quickstart but I can indeed find the documentation about it in the bundle. The odd thing is that is says that I could use e.Instance but when I look further into it visual studio added the "wrong" signature for the OnInserting event

protected void PartDataSource_Inserting(object sender, Microsoft.Practices.Web.UI.WebControls.ObjectContainerDataSourceInsertingEventArgs e)
{}. In this case e.Instance doesn't exist. If I try to change it to the same as OnUpdated
protected void PartDataSource_Updated(object sender, Microsoft.Practices.Web.UI.WebControls.ObjectContainerDataSourceStatusEventArgs e)
{} I get

No overload for 'PartDataSource_Inserting' matches delegate 'System.EventHandler<Microsoft.Practices.Web.UI.WebControls.ObjectContainerDataSourceInsertingEventArgs>'

What am I missing? Maybe I have an old assembly version.. /syggen
Mar 27, 2008 at 3:38 PM


What am I missing? Maybe I have an old assembly version.. /syggen


My bad :( There are actually two Code installs; one will create a WCSFBlocks-Feb2008 folder and the other will create a WCSF-Feb2008 (where the quickstart resides). As you drill down to the menu option referenced above run the second Web Client Software Factory Source Code Install.

Looks like intellisence might have injected your problem as the documentation indicates that ObjectContainerDataSourceStatusEventArgs is used for all of the CRUD methods:

Mar 27, 2008 at 3:39 PM
Sorry look at the wrong event. Changing to OnInserted instead. I still can't find the quickstart which would be very helpful :).

BillKrat : Where do I find the menu option to install Composite Web Client Library Source Code Install so I get the quickstart?

Br
Mar 27, 2008 at 3:41 PM

BillKrat wrote:


What am I missing? Maybe I have an old assembly version.. /syggen


My bad :( There are actually two Code installs; one will create a WCSFBlocks-Feb2008 folder and the other will create a WCSF-Feb2008 (where the quickstart resides). As you drill down to the menu option referenced above run the second Web Client Software Factory Source Code Install.

Looks like intellisence might have injected your problem as the documentation indicates that ObjectContainerDataSourceStatusEventArgs is used for all of the CRUD methods:




Ok thank you. I will dive into it :)
Jun 23, 2008 at 9:31 AM
Edited Jun 23, 2008 at 9:33 AM

Sorry I might be too late to help. But hope it can be reference to others in the future.

e.Instance can only be found in Inserted and not Inserting event.

If you are using Bind( ) in the web form (for e.g form view), most probably you do not need to have Inserting event to assign the value into e.NewValue.

What you may need to do is to insert the following code into Inserted event of ObjectContainerDataSource.

        _presenter.OnInsertFunc( (data_object_type) e.instance);

        OnInsertFunc is a user defined function in Presenter to deal with Controller(if you enable it) or Data Access classes.

But if you have additional values that are not captured during user input, you may need to use OnInserting event to insert value, then OnInserted event to submit the value to Presenter layer.

Regards,
Chris Par
http://chrispar.blogspot.com