CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

How to update related objects

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 1 Follower

Not Ranked
1 Posts
Khaled posted on Sun, Jun 24 2012 7:32 AM

Hello,

I have BB that could have children of the same type, I have property to determine if the current instance is Simple or Complex

and I have Price property

Let me give you this example:

Water (Simple), Sugar (Simple), Milk(Simple), Pie(Complex), Tea(Complex)

Pie contains: Water + Sugar + Milk
Tea contains: Water + Sugar

Breakfast contains: Pie + Tea + Water

so if I open Pie window and edit the Price of sugar, ChildChanged will fired and I will update price of the Pie,

but Breakfast cost will not get updated until I open its window and manually call refresh method which will do all the calculation.

my question is this, can I automate this process as I had a lot of objects and I can't figure what is the best practice to fix this problem.

I am thinking of updating this using linq but I am hoping to find a better more robust solution

 

All Replies

Top 10 Contributor
1,770 Posts

Well,

The safest way is to do this within triggers in the database.

If you wish to do this outside the database then I would create CommandObject(s) to do the recalculation and call this from the Update method of the actual BusinessObjects. Remember this will have to be done recursively.

 

Jonny Bekkum, Norway CslaContrib Coordinator

Page 1 of 1 (2 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems