If I put a debug statement in my AddBusinessRules & AddObjectAuthorizationRules functions, like so:
System.Diagnostics.Debug.WriteLine("SL AddObjectAuthorizationRules() called for type: " + typeof(T));
System.Diagnostics.Debug.WriteLine("NET AddObjectAuthorizationRules() called for type: " + typeof(T));
I noticed that they are being called once on the Silverlight side and once on the .NET side for each type.
Is that the expected behavior?
They are called once per type per AppDomain. In a 3-tier deployment you have two AppDomains, one on the client and one on the server.
In a 4-tier deployment you have three AppDomains (client, web server, app server).
The rule definitions aren't serialized over the wire - that'd be very expensive. It is much cheaper to rehook the definitions on each side of the wire.
The end result is that your types have the same rules on both sides of the wire, so you can interact with the objects in either place and get the same results. That's the whole idea behind mobile objects.
That's what I thought.
I just was doing a sanity check here to make sure the change I just made to my AddBusinessRules & AddObjectAuthorizationRules didn't break something, because I swear these functions looked like they were getting called just once per type before.
Thanks for the clarification.
Copyright (c) Marimer LLC