Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:10:16+00:00 2026-06-09T06:10:16+00:00

I am adding a rounding business rule to round a decimal property value to

  • 0

I am adding a “rounding” business rule to round a decimal property value to the number of decimal places specified in a separate integer property. This works nicely if both properties are members of the business object in question. As in the following VB.Net code…

BusinessRules.AddRule(New Round(_decimalProperty, _precisionProperty))

I have a private Round class that inherits from CommonBusinessRule and its constructor is as follows:

Public Sub New(decimalProperty As IPropertyInfo, precisionProperty As IPropertyInfo)
    MyBase.New(decimalProperty)

    InputProperties = New List(Of IPropertyInfo)()
    InputProperites.Add(decimalProperty)
    InputProperties.Add(precisionProperty)
End Sub

This triggers the rule Execute whenever either property changes, and the Execute code rounds just exactly like I want.

The Problem: I now have a situation where the precisionProperty is a property of the Parent business object. When the CSLA method for adding Business Rules for the Child Business Object is called, the Parent member of the Child Business Object is null, so I can’t get to a reference of the parent’s property. Is there any point in time AFTER the Parent field is no longer null, that I am allowed to add a new Business Rule? If so in what method? Is there another approach?

We have looked into passing down a reference to the parent business object (via constructors) to the child, but have decided against this approach for now (the child is actually 6 levels deep, and it appears this would require rework of our code generation schemes).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:10:18+00:00Added an answer on June 9, 2026 at 6:10 am

    The parent property in the BusinessBase is generally used by the BusinessListBase to keep a relationship with its children. The parent property really isn’t(shouldn’t be?) used outside of that.

    When I have a parent object with a property that affects child objects, I put the rule in the parent object that will then invoke any rules on the child object. You can pass in any values you like, even to the point of having a copy of the property on the child and just setting that as the parent property changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the value of a number to 2 dec places from
I was making a program that rounds up numbers with various decimal places, so
Adding a comment such as this: // TODO: Refactor this code ...creates a task
Adding attributes to members works well because the syntax is exactly like it would
I need to print or convert a float number to 15 decimal place string
Adding a Display Attribute to a property then having the DataField automatically do its
adding value together. so: 1 + 0 = 1 3 + 1 = 4
Adding a service reference to a web service (this is all WCF) in Visual
Adding this code def send_messages return if recipient_list.blank? recipient_list.each do |recipient| recipient = User.find(recipient)
Adding more and more configurations to my servlet container ( Embedded Jetty in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.