MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

Business Rules running slow and sometimes getting a Silverlight crash` #147

Open viney-jindal opened 8 years ago

viney-jindal commented 8 years ago

Hi JonnyB,

I am using CSLA Business object (Edit Objects) with MVVM approach using Silverlight. My project is quite old so continuously adding business rules to support new features. My rules are divided into two categories - Validations and Calculations. But now with course of time, the Edit object is getting bulky and crashes at client side due to these much businessrules. I have around 250 validation rules and 250 calculations rules.

Also I was getting Timeout error in Silverlight client but I have increased the Response time and other timeout settings: ReceiveTimeout = new TimeSpan(0, 10, 0), CloseTimeout = new TimeSpan(0, 10, 0), SendTimeout = new TimeSpan(0, 10, 0), OpenTimeout = new TimeSpan(0, 10, 0),

But now client is able to wait for time but I am after preventing Crashes. So trying to workout on HOW can I fasten up the Rules running on Silverlight so that the UI responses and doesn't crash.

Another question in relation is there any way I can put some logging in Suspected Business Rules? I want to make sure that none of my BR is interacting with any DB.

jonnybee commented 8 years ago

Which version of CSLA are you using?

I would first use a profiler to try and determine which rule(s) or events is taking much processor time. There's built in profiler in Visual Studio as well as commercial ones that can be utilized for this.

Do not forget that rules also involve events such as "PropertyChanged" and code in event handlers may also take considerable time and slow down you system.

This should hopefully provide you a more precise target on which part of your app is "heavy" and to be optimized.

Typical bottlenects is