Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

ValidationComplete, IsBusy, Async Rules

$
0
0

I am running into a strange result. I have a business object with async rules. I am running unit tests to test basic crud operations. Update works fine. Insert gives me the Cannot save while IsBusy error. It seems IsBusy remains true even after the ValidationComplete event fires. Any ideas? Here is the code;

var validationCompleteEvent = new ManualResetEvent(false);

var item = MyEntity.New(Guid.NewGuid());

Assert.IsNotNull(item);

item.ValidationComplete += delegate { validationCompleteEvent.Set(); };

item.Name = "Test"; // Triggers the async rule.

validationCompleteEvent.WaitOne(5000,false);

item = item.Save(); // Get error here


Viewing all articles
Browse latest Browse all 764

Trending Articles