I am currently using CSLA with Silverlight and everything is great. I now have a need to build an ASP.NET MVC application. I read the other threads on this forum about this same issue and didn't see my particular question answered.
With Silverlight's client side bus obj and excellent xaml data binding, we can do things like instant field validation, bus rules that cause property changes, property changes that cause other property changes, dynamically changing property security with CanWriteProperty overrides, etc -- and the xaml ui responds as expected.
Here is a simple example. Two radio buttons A and B. When A is selected, need to set property X to something and property Y to something else. When B is selected, need to do different property changes.
It seems like in MVC I would need to do postback for every single field change in the html ui to get the same effect. Plus I would have to do server side caching of bus obj so postback doesn't have to fetch obj from db every time because the order of property changes might be important to the way the bus obj enforces rules so I cannot start with a freshly loaded or created obj instance every time,
How are people handling this situation?
Similarly, Csla.Web.Mvc.HasPermission() looks great except that it only is used when the view is rendered -- not on property change.
Typically people use a postback, though that's changing as the demands for more Windows-like behavior in web pages increases. The postback solution works fine with CSLA objects - the CslaModelBinder helps ensure the user gets a consistent result based on the rules in the business objects. I discuss and demonstrate this in the Using CSLA 4: ASP.NET MVC ebook.
The AJAX approach is largely unworkable for anything but the simplest objects/forms. As soon as you have interdependent properties (or worse, interdependent objects) then the complexity of sending the data server-side for validation gets pretty ugly.
Thanks Rocky. Nothing compares to the power and ease of development of Silverlight for rich browser based LOB apps. I wish Microsoft would be more vocal in its support because my customers are now questioning the choice of Silverlight even though MS has promised at least 10 years of support. Sorry I missed you last weekend in Orlando. Cory (Magenic Atlanta) invited me to the Sunday dinner but I have too many December deadlines so I couldn't attend.
Thanks. I will take a look at Knockout. It sounds like you are adding a REST API on top of your CSLA bus objects, correct? I am afraid that for me that will be a huge burden. My application has hundreds of CSLA business objects. The majority of the code is generated using a custom T4 generator I wrote whose input is some XML metadata. We use optional partial classes to implement non-standard bus obj functionality.
I am actually working with a Magenic consultant on building a proper consumable web service API (SOAP in my case) but this API is really designed to expose a small subset of my application's functionality for specific purposes; it is not intended to expose all functionality which is pretty much what I would need for a pure HTML based app.
asinc: wow I've been thinking the same thing and I just ran across your post. I'm going to start working on this. How is your work progressing and are you still working on this?
Copyright (c) Marimer LLC