Coder Social home page Coder Social logo

Comments (3)

jonnybee avatar jonnybee commented on May 26, 2024

My preference is to NOT use BusinessRules to load complex objects (as in Lazy Load Properties).
A business rule must be considered a singelton and shared instance for ALL instances of this type. So the only way to send parameters is to pass them as properties in the BO.

You must also remember that rules may be run often - and not just when a property is changed.

There is some possibilities to limit when a rule is called, look at PropertyRule base class and the properties:

  • CanRunAsAffectedProperty
  • CanRunInCheckRules
  • CanRunOnServer

And see my blog post https://jonnybekkum.wordpress.com/2011/08/29/csla-4-2-rules-update/

You must also be aware that the PropertyChanged event is also used to notify the UI of "possible" changes in a property in order to update the displayed value.

You could also implement this in the ViewModel - that already has the CustomerID and DoorID by subscribing to the PropertyChanged on the DoorDetail object.

from cslaforum.

jonnybee avatar jonnybee commented on May 26, 2024

You could store values into LocalContext dictionary and have the rule read values from the context - but I would not recommend that approach.

from cslaforum.

rockfordlhotka avatar rockfordlhotka commented on May 26, 2024

The business object should contain all the information necessary for it to do its work. If it needs those values, then those values should be properties (probably read-only) in the object.

I wouldn't think they'd be passed in by the viewmodel - they'd be provided as part of the criteria used to create/fetch the object.

If those values are changing during the lifetime of the object, then perhaps your object model needs to be rethought a little to recognize that there are other objects at play.

from cslaforum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.