Mobile object Working in CLSA .NET

Mobile object Working in CLSA .NET

Old forum URL: forums.lhotka.net/forums/t/8763.aspx


Harmanjeet posted on Monday, April 05, 2010

I have a Question related to mobile object's working in CLSA.NET. Can, anyone explain me how the mobile object pass across physical tier as a VALUE and if application deployed on same machine as a REFERENCE.

.........Looking for code snippet where it's all happening.

 

 

I'll appreciate a Quick Reply....

RockfordLhotka replied on Monday, April 05, 2010

You should read chapter 1 of the Expert 2008 Business Objects book, because that explains the concept behind mobile objects.

There is no "code snippet" to show you - the data portal is what makes this work, and the data portal is relatively complex. Chapter 2 has a good description of the data portal and how it is designed.

If you are using current versions of CSLA you should know that the data portal (by default) never passes objects by reference, even when configured to run locally. It automatically clones objects to simulate the same behavior as if you were using a remote data portal.

Harmanjeet replied on Monday, April 05, 2010

Hi! Rockford Lhotka (on Friday I was not aware of this Name, someone asked me in an Interview I said I don't know, then He said you are not Architect then :) )

Thanks aLot for quick reply. as you said ...I already read 1 and 2 chapter that;s by i got to know CLSA using Mobile Object.

from your asnwer..can I understand that , it doesn't was mobile object by REFERENCE ?

if yes then ok..if not please explain me how ?

I know how CLSA passing Mobile object by VALUE ( populating the object on Client (WebServer) from Same Object on Application Server using REFLECTION ).

please clear this.......

RockfordLhotka replied on Monday, April 05, 2010

The client and server don't have the same object. They have clones of the same object. So logically they have the same object, but physically they do not.

This is true with a local data portal (by default), and with always with a remote data portal.

The client sends a criteria object to the server so the server can return a business object. Chapter 4 includes sequence diagrams showing how this works.

But what happens is that the criteria object is created on the client. It is then cloned to the server, so the server has an exact copy. The server uses the information in the criteria to create a business object. The business object is created on the server, and cloned to the client. So the client has an exact copy.

The result is that the objects seem like they are being passed by value - and in a very literal way that is what is happening.

If you watch American movies you might have seen "The 6th Day" with Arnold Schwarzenegger, where he is cloned. It is a fun movie, and is a good example of what is happening with objects and the data portal Big Smile

Harmanjeet replied on Monday, April 05, 2010

Hi!

Thanks again.

What type of clone/copy is it ? Deep? I think so. you ?

RockfordLhotka replied on Monday, April 05, 2010

"Deep" is not a precise term. In theory you can do a "deep" copy with XmlSerializer, so so people tell me. But a "deep" copy using XmlSerializer is still very shallow.

CSLA .NET uses the BinaryFormatter or NetDataContractSerializer on .NET, and the MobileFormatter on Silverlight. These serializers are "very deep". They copy the entire object graph (not just one object, but the whole graph), and they copy at the field level, not the property level. So they are making exact copies of the original objects.

Harmanjeet replied on Monday, April 12, 2010

Thanks for clarification.

Imker replied on Monday, April 12, 2010

so apart from the Business Object Books and videos,  "The 6th Day" with Arnold Schwarzenegger

is also on the required reading/viewing list.... you really rock, Rockford!

Copyright (c) Marimer LLC