Vibrant discussion about CSLA .NET and using the framework to build great business applications.
InitializeBusinessRules is marking the rules as Initialized before it is really initialized.
If a second thread reaches this method while the first thread is still loading the rules, you´ll get a error. To correct this error is necessary to put the line "rules.Initialized = true;" after "AddBusinessRules();":
private void InitializeBusinessRules()
{
var rules = BusinessRuleManager.GetRulesForType(this.GetType());
if (!rules.Initialized)
lock (rules)
rules.Initialized = true;
try
AddBusinessRules();
}
catch (Exception)
BusinessRuleManager.CleanupRulesForType(this.GetType());
throw; // and rethrow exception
Thank you for finding this issue, I'll fix it in 4.3 and 4.5.
Rocky