CSLA and Infragistics

CSLA and Infragistics

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


bmoneil posted on Tuesday, April 14, 2009

Purchased the Net Advantage suite of tools and I'm putting together a web user interface for an application that uses CSLA as the business layer (and DL). Using the CSLADataSource control to bind to the AJAX WebDataGrid and I'm finding that I need to shut off AutoCrud feature and manually handle the 'ing' data access events from the grid eventhough my CSLADataSource is bound to the grid.

It appears that the grid doesn't even call the CSLADataSource at run-time because none of the CSLADataSource events are firing. Although through manually coding and wiring up the 'ing' data operation events on the grid I was able to get everything to work except:

1. The grid is not updated when a new record is added, but if you hit refresh the new record appears in the grid.

2. Only the first row edited (e.g. edit cell, blur, click on Save Updates button in AJAX panel) displays the changes in the grid. If you edit more than one record then the changes are not displayed in the grid until you refresh the page.

If I enable AutoCrud and unwire the 'ing' data operation events from the grid then all I get is a bunch of exceptions. For example, on deleting a record I get - Original data source does not support deletes (even though my CSLA BL objects all Allow Edits, etc.

If I add a record I get - Original data source does not support inserts.

My question -- Does anybody use CSLA 3.5 with Infragistics AJAX ASP.NET controls or ASP.NET controls with or without having to write a lot of code behind to make it all work?

Also, if CSLA is not the choice for Infragistics controls then what DL,BL framework do most people use?

RockfordLhotka replied on Tuesday, April 14, 2009

If the grid isn't invoking the data source methods, then one of two things is true

  1. The grid doesn't work with normal ASP.NET data binding - which would be shocking for a major component like that
  2. Somehow you don't have the grid set up right, so it isn't properly interacting with data binding

No controls ever call the CslaDataSource - data binding calls the CslaDataSource, just like it does for all data source controls. UI controls interact with data binding, which handles those details. This is why controls don't care what the data source is (sql, xml, etc) because they never interact with the data source control directly. The CslaDataSource is no different - it implements the same interfaces/base classes as any other data source control.

JoOfMetL replied on Wednesday, April 15, 2009

Are you sure ? I think I have already used it and it works. It is very important to define the property that is the key to your subject, otherwise the events are not raised

rfcdejong replied on Wednesday, April 15, 2009

My team is using the Infragistics controls for WPF, the newest version. Which work all fine, except that they work against my application layer above the frontend framework called Composite Application Guidance. The CSLA business objects are being used as Model which goes into the DataContext. Not using the CSLADataSource since the app controller base class is doing what the datasource does.

But I don't believe there is a bug in the datasource component, u must be doing something wrong.

bmoneil replied on Wednesday, April 15, 2009

We were using the Code Complete code generator to create our CSLA classes.  For the heck of it I hand coded a class for testing purposes and found that it works fine in the same setup with the Infragistics AJAX WebDataGrid and AutoCrud.

We are going to check out the differences between what was hand coded and what CC generated tomorrow.

Thanks for the replies.

bmoneil replied on Friday, April 17, 2009

Update:

In comparing the Code Complete generated BL classes to the hand coded classes (based on the latest CSLA book) it appears that the main difference is that the book suggests using the BusinessListBase base object and CC is using EditableRootListBase base object which appear to be similiar, but are different.

The Infragistic WebDataGrid just throws a "Original data source does not support _____" exception (fill in the blank with your favorite CRUD method) when using the CC BL list.

I should metion that CC really wants to generate a complete application and includes web, win forms, and wpf user interface generation so they may use the ERLB base class to keep their supplied user controls that are used in the UI code generation happy.  Although this may work fine with their generated UI code it doesn't appear from my experience to play nice with 3rd party controls.

I've sent a message to CC and I'm waiting their reply.

ajj3085 replied on Friday, April 17, 2009

The ERLB class is not designed for use in an Asp.Net environment. Actually, ERLB has a very well defined, and rare, use case, which is when you want each edit to a row on a RICH client to commit immediately to the database once the row is 'commited' (moved off of). Otherwise, you should be using BLB for your list subclasses.

Sounds like CC doesn't understand the sterotype that ERLB was designed to address, and they should be using BLB.

Copyright (c) Marimer LLC