Client-Side access to BOs, their method invocation and two way integration with web controls

Client-Side access to BOs, their method invocation and two way integration with web controls

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


sachseb1 posted on Thursday, September 18, 2014

Rocky, I have been a huge fan of your framework, publications, thoughts and patterns for years and have used the CSLA framework in many enterprise applications within our fortune 500's custom applications.

Our team has created a streamlined, loosely coupled framework that extends to the client to offer access to business objects and their methods with virtually no middle layer code modification per instance.  Additionally, it integrates html controls to the data defined by the corresponding business object with a pattern of self description and a single line of activation code.  This allows two way integration between the control and the database (via the bo). 

As an additional benefit of this extension, we have been able to create the appropriate patterns to allow view level access, while keeping the responsibilities at the server side object level for security, reliability and guaranteed rule adherence.  Finally, we've capitalized on the dynamic creation of those views for an easy to retrieve, secure, robust web control.

I would like to have a discussion with you, Rocky, around the potential that this offers and whether or not you may be able to capitalize on the technique and extension for the CSLA framework.  

 

Here is an example of the usage to add 3 carrots to your shopping cart and update the screen afterward:

       var Cart = new SmartObject('Cart', CartId);

        Cart.InvokeMethod('AddItem'

               , GetArray('Carrot', 3)

               , function () {

                   if (typeof (LoadList) == 'function') LoadList();

               }

           );

 
Here is an example to access the attributes (specifically total tax) of the Cart and update the label.
        var Cart = new SmartObject('Cart', CartId);
        var cartAttrs = Cart.LoadData();
        var taxOnSale = cartAttrs.TotalTax;
        $('#lblTaxOnSale').text(taxOnSale);
 
This is an example of updating the control with the data (including the self description markup) from the bo dynamically on the client:
       $('#divUserObject').smartControl();
 
Updating the database from the control:
      $('#divUserObject').updateFromSmartControl();
 
An example of reloading the entire user control and replacing the html dynamically - which allows for control specific, postback free loading (similar to ajax UpdatePanel):
       $('#divUserObject').fetchSmartControl({
            params: {
                entityType: 'UserObject'
                , entityId: UserObjectId
            }
        });
 
Having only seen the csla.js briefly and reviewing the code, I see some overlap in the serialization and reflection, bu,t still believe that we've pushed the envelope a bit further because of the dynamic nature, integration with html controls and less middle layer coding required of this implementation. I would be happy to be corrected, if that is not true.
 
I don't know the right forum to begin the conversation with you around this topic, and apologize if this isn't it, although I assure you that I'm not a hack and/or looking for a sale, here.  I firmly believe that you will enjoy the conversation, if given the chance to have it.  We have several very solid examples and implementations with real business solutions that we could share with you and discuss, if you'd like to hear more. 
 
Rocky, is this something you'd like to discuss with us.  If so, I promise to be brief, mutually beneficially intelligent and somewhat entertaining.  Thank you for any feedback.

Copyright (c) Marimer LLC