[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Remote type binding problem

Alejandro Gaio

10/5/2004 7:07:00 PM

Hi all,

I have an issue here, and I wish to know if anyone has "suffered" from this
also...
The problem happens when I bind a remote object that implements the IList
interface to a Listbox control. If the object is local (i.e. no remoting in
between), it works fine, but when this object is
obtained remotely, the object binds to the list, but it doesn't show the
actual list "values". Instead it shows the type name of the
list objects.

For example, with a remote object, the Listbox after databinding looks like
this:
_______________________
| TestApplication.Application |
| TestApplication.Application |
-------------------------------

If I comment the remoting code and get the object locally, the Listbox looks
like this (fine!):
_______________________
| Customers |
| Invoices |
-------------------------------

To clarify things, I'll copy the code below with this explanation:
There are 3 classes in an DLL assembly in a remote server. All the classes
derive from MarshalByRefObject.
* One class is the remote object that the client obtains after
configuring remoting (it's configured as a Singleton)
* The other is a class that implements IList
* The last one is a class that will fill the IList class (above).

The classes look like this (the code was simplified and hardcoded, also no
try...catch blocks, etc...)

Public Class BusinssRules
Inherits MarshalByRefObject
Public Function GetApplicationList as ApplicationList
dim a as Application, aList as new ApplicationList
a = new Application
a.AppID = 1
a.Name = "Customers"
aList.Add(a)
a = new Application
a.AppID = 2
a.Name = "Invoices"
aList.Add(a)
return aList
End Function
End Class

Public Class ApplicationList
Inherits MarshalByRefObject
Implements IList
' *** IList Implementation (Not showed since is not relevant )
End Class

Public Class Application
private m_AppID as Int32
private m_Name as Int32
Public Property AppID() As Int32
Get
Return m_AppID
End Get
Set(ByVal Value As Int32)
m_AppID = Value
End Set
End Property
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal Value As String)
m_Name = Value
End Set
End Property
End Class

I've made a host application to run in the server called host.exe.
After configuring remoting at the client, I bind ApplicationList to a
ListBox control with the following code:

Dim br as BusinnesRules
Dim appList as ApplicationList

RemotingConfiguration.RegisterWellKnownClientType(GetType(BusinessRules),
"tcp://RemoteServer:8989/BusinessRules.rem")
appList = br.GetApplicationList()
ListBox1.DataSource = appList
ListBox1.DisplayMember = "Name"

Any suggestions?
Thanks in advance
Alejandro.-