DataBinding with CSLA.Net 2.1.4 and 3rd party controls

DataBinding with CSLA.Net 2.1.4 and 3rd party controls

Old forum URL: forums.lhotka.net/forums/t/4222.aspx


alancaster posted on Wednesday, January 23, 2008

I am trying to track down some examples of data binding in a WinForm that use CSLA.Net 2.1.4 business objects and advanced 3rd party UI controls such as those from Infragistics.

The Infragistics Knowledgebase has an older example of data binding their WinGrid to custom business objects using the ORM.Net framework - that article is located here:

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7395

The problem is the example above does not use the System.Windows.Forms.BindingSource control, and the ORM.Net framework looks like it is really just a thin wrapper around ADO.Net DataSets, and not an advanced business object framework like CSLA.Net is.

What I am searching for is a Winform example of an Infragistics WinGrid bound to a CSLA.Net business object through the System.Windows.Forms.BindingSource control like Rocky did in the PTracker project, so whatever the user does in the WinGrid is reflected in the state of the business object(s) behind the WinGrid via the BindingSource control.

The problem is we have all these fancy 3rd party control developers like Infragistics, ComponentOne, Telerik, DevExpress etc... and then we have all these fancy business object frameworks like CSLA.Net, PDSA.Net, ORM.Net etc... so what is the magic link between the fancy controls and the fancy business object frameworks to make them all play nice without having to write a lot of code to link the two worlds together?

It looks like CSLA.Net 2.1.4 business objects are built to work well with the System.Windows.Forms.BindingSource control without having to write a bunch of code in the UI.  Where can I get more information on how to link the BindingSource control to the 3rd party controls that companies like Infragistics build so that I can create a sample app like PTracker using advanced UI controls but still have minimal code in the UI that links to CSLA.Net business object classes because both the UI controls and the CSLA.Net classes are talking to each other through a BindingSource object (so they both know how to invoke the correct Create, Read, Update, Delete operations in the other's world to keep each other in sync)?

Thanks.

ajj3085 replied on Wednesday, January 23, 2008

I use Infragistics here.  Basically you do just what you would in the PTracker; binding your BO to a BindingSource, and bind the BindingSource to the grid or other control.  Works great.

I should point out though that the 2.x line is pretty much dead; you can use 3.0.3 even for .Net 2 projects, just define the NET20 compiler symbol to avoid building the .Net 3 stuff.

I know others here also sucessfully use ComponentOne and DevExpress controls.

If you want to be "lazy" you can pretty much delete the DataGridView in the PTracker sample and repalce it with the UltraGrid.  You may have to rewire some events and change some things to match the properties of the ultragrid, but that should only take you a few minutes.  I pretty much did just that when I got Infragistics; delete the DGV, and drop in the UG and go.

alancaster replied on Wednesday, January 23, 2008

Ok, I'll switch over to v3.0.3 and see if I can get some Infragistics controls to work with the BindingSource just like the PTracker project does with native controls.

So you've been able to use just about every 2007v3 Infragistics control through a BindingSource which is attached to a CSLA 3.0.3 BO and everything works great?  Especially where the WinGrid is concerned which is one of their most advanced controls, all the grid's CRUD operations work fine via the BindingSource and the grid keeps in perfect sync with the BO?

If you used CSLA 1.1 with .Net 1.1 and an older version of the Infragistics controls, what were you doing to manage the data binding in Winforms back then?

Thanks.

ajj3085 replied on Thursday, January 24, 2008

Well my subscription ran out so I'm only at 2007.2.  The grid works as expected, although i don't use any n-level undo from Csla, I let databinding doing the editing calls. 

I haven't used Infragistics controls with .Net 1.1.

Copyright (c) Marimer LLC