-
Jonny, First, your thoughts are excellent and I appreciate you sharing them with me. You have certainly inspired my thinking on this. I'll respond now to your last post: 1. With all due respect I would not call these business rules. In my mind these are behaviors that the BO must perform in response to an action (in this case a property being set
-
Thanks for the post Jonny. I've had to think about this a bit and I'm not sure I'm on board with the solution for a couple of reasons: 1. Using a business rule to perform some basic data mapping seems like an inappropriate use of "rules". I'm not sure if Rocky intended out values to be used in this way. It's clever, but
-
This is part question and hopefully part discussion. I've been developing business objects using CSLA for many years and frequently come across the need to include what I would describe as read-only info properties on a business object. Let me give a quick example. Say you have a Customer class and a CustomerType class. The CustomerType defines
-
I'd like to get some opinions on how to handle the following situation. I have a property on a Customer object called StateCode. This is a string that establishes the US state for a customer (eg, NY). I also want to have a property on Customer called StateName that returns the full name of the state (in my example, New York). This would be a read
-
The reason I need to override Save is because I need to remove some items from a child collection first. It's very domain-specific. I'm working with an Order and OrderDetail objects and the OrderDetails collection is pre-populated with data from a set of customer preferences - products the customer usually orders. When a new order is created
-
Here's the code from, yes, CSLA 4 Beta, Csla.BusinessBase<T>: public virtual T Save() { T result; if ( this .IsChild) throw new NotSupportedException ( Resources .NoSaveChildException); if (EditLevel > 0) throw new Rules. ValidationException ( Resources .NoSaveEditingException); if (!IsValid && !IsDeleted) throw new Rules. ValidationException
-
Csla..BusinessBase has a virtual Save method that I'm overriding in a class in order to perform some actions before the Save is executed. However, my overrided Save method is not being called. I'm using the ViewModelBase class from the Csla.Xaml namespace for my "Order" class. I called the Save method of ViewModel<T> which in
-
I agree testing in isolation is a non-issue. I was simply stating that I do not want to test the business rules through a business object. What I'd like to see is a way to inject a RuleContext into the Execute method. This could be accomplished by providing a public IRuleContext interface from which I can build a mock / stub / double to inject into
-
I'd like to be able to write unit tests for the custom business rules I create so that I can verify the rules work as expected without having to test them through a business object that uses them. RuleContext does not have a public constructor and there is no interface that can be implemented in a test harness class to provide the context for the
-
I agree that it's unnecessary to initialize the collection for every rule. However, I don't like the fact that a property from a base class throws a NullReference exception if I try to use it, especially for collections. I believe it's more natural and less error-prone to return an empty list. Might I suggest that a better approach would