MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

Trigger Business Rules Validations in javascript Applications with CSLA #328

Open cslacoder2017 opened 7 years ago

cslacoder2017 commented 7 years ago

In WPF/MVC app, we can see from the books that CSLA provide wiring between UI and business/Validation/Authorization rules fired on BOs.

How the similar functionality is achieved in javascript apps(Jquery/Angular) with ASP.NET WebAPIs on the server side ? We are assuming that in these cases Web server will be the dataportal client and Application Server will be the data portal server.

jonnybee commented 7 years ago

A javascript app is handle in the same way as any other http POST/PUT.

If you use the MVC/WebAPI built in ModelBinder - CSLA rules will be called for each property set (similar to that of a rich client UI). CSLA aslo provides a CslaModelBinder that disable rule checking for each property and rather call BusinessRules.CheckRules to check all rules after all propeties has been set from the request.