When using MVC binding you probably want to postpone the property checks till after all properties are bound. When using BypassPropertyChecks however, IsDirty management is also disabled. So after binding IsDirty is still false (suppose it was false before binding). Manually invoking MarkDirty leads to possible unnecessary database updates.
Any thoughts?
>> When using MVC binding you probably want to postpone the property checks till after all properties are bound. <<
Can you further explain why you want that? When you do model binding, it is not any different than setting the values that come from the form to the model directly...e.g.
myModel.FirstName = form["FirstName"];
So I don't see why you would wan't to disable property checks.
So I don't see why you would wan't to disable property checks.
There are good reasons to suppress the checks.
In a complex object with dependent rules, it is quite possible for a rule to be run numerous times as various properties are changed. In an interactive application that's good.
But in a block mode app like the web or a service, all the property values are set as a block/batch and it is inefficient to run the rules multiple times. It is more efficient to suppress rule checking, load all the property values, resume rule checking and then force all rules to run. The new ISuppressRuleChecking interface supports this approach.
That makes sense, wasn't aware this was in CSLA. So do you have to explicitly call a method to run the validation rules after setting the properties? Is there any info on how this works/examples.
Thanks.
Found it.
http://www.lhotka.net/cslabugs/edit_bug.aspx?id=790
http://www.lhotka.net/cslabugs/view_svn_file_revisions.aspx?id=790
There's a new ASP.NET MVC sample in the Samples download - or will be in the next release. Gary added it to svn a few days ago, so you can get it there, or when the beta for 4.0.2 starts.
This is not the purpose behind BypassPropertyChecks. What you want instead is the SuppressRuleChecking property on BusinessRules (ValidationRules in 3.8 and earlier).
In CSLA 4 there's an ISuppressRuleChecking interface on BusinessBase so a UI framework can directly suppress, resume and check rules - specifically added to make ASP.NET MVC development easier.
Thanks, that's what I was looking for
Copyright (c) Marimer LLC