Re: What about CAO?
- From: "RCS" <rseder@xxxxxxxxx>
- Date: Thu, 11 Aug 2005 13:12:59 GMT
I'm totally with you up until "take care of lifetime issues" - that's an
area I'm fuzzy on. Can you give me one more tiny push of where I should look
to control the lifetime of these objects? I haven't found any
good/understandable references! :-(
And also, how I'm doing this now with Activator.GetObject() - methods work
fine, it seems that it's not keeping state because properties aren't keeping
their values. So if I have the remoting service set as SingleCall - it's
like it creates an object for every time I make a reference to a remoting
object - which seems, utterly ridiculous. And when I set it to Singleton, it
keeps state - but only has one state for ALL callers that use it, which is
obviously not right either.
I just want a remoting object to act like a local object - you would've
thought that would be the very first thing they would've worked on, when
designing this technology!!
"Helge Lenuweit" <""nospam\"@nospam@xxxxxxxxxxxx"> wrote in message
news:ddf434$vf9$1@xxxxxxxxxxxx
> Hi,
>
> using an interface-only approach, it's not possible to instantiate a new
> CAO object on the client side - you can't just use "new MyObject(...)"
> because the implementation is only available on the server.
>
> One possible solution to this is to extend your shared assembly with an
> interface for a SAO object. It needs a single method which returns a new
> instance of the CAO, like GetCAO(). Now implement this interface on the
> server and expose the object. Then get a reference of this object on the
> client via GetObject (you do not instantiate the object, you get a proxy
> of the existing one from the server - so it will work with the interface
> only on the client).
>
> Now that you have the SAO instance on the client, call its method that
> returns the CAO. Make sure to appropriately take care of lifetime issues
> and this object will retain state.
>
> Regards,
> Helge
>
>
> RCS schrieb:
>> So have a successful remoting environment setup with a shared assembly
>> that stores the interfaces-only that are available. The client has a
>> copy, and the remoting server has that, and also has objects that are
>> offerred, that implement those interfaces.
>>
>> On the client, I am using Activator.GetObject() to create the object, but
>> it's not keeping state. To be more specific, I'll set properties, and
>> they don't keep. It's as if every call is a new call to the server.
>>
>> So it looks like from everything I've read, that I should be
>> instantiating these objects different, as CAO - but I can't seem to find
>> the syntax for this. For example, here is my function for creating an
>> object:
>>
>> Private Function GetRemotingObject(Of typ)() As typ
>>
>> Dim InterfaceName As String = GetType(typ).ToString()
>>
>> Dim intLastPos As Int16 = InterfaceName.LastIndexOf(".")
>>
>> If intLastPos > 0 Then
>>
>> InterfaceName = InterfaceName.Substring(intLastPos + 1,
>> (InterfaceName.Length - intLastPos) - 1)
>>
>> End If
>>
>> Return CType(Activator.GetObject( _
>>
>> GetType(typ), _
>>
>> "http://" + WEBSERVER + "/WASRemoting/" + InterfaceName + ".rem") _
>>
>> , typ)
>>
>> End Function
>>
>>
>>
>> Sorry for the VB, but the front-end needed to be that way, because I'm
>> whipping up examples for other duh-velopers. So how else could I
>> instantiate this object via remoting to make it CAO, and ideally - keep
>> state??
>>
>>
.
- Follow-Ups:
- Re: What about CAO?
- From: Helge Lenuweit
- Re: What about CAO?
- References:
- What about CAO?
- From: RCS
- Re: What about CAO?
- From: Helge Lenuweit
- What about CAO?
- Prev by Date: Re: Calling events on the server
- Next by Date: Re: Help - N Tier Architecture ?
- Previous by thread: Re: What about CAO?
- Next by thread: Re: What about CAO?
- Index(es):
Relevant Pages
|
Loading