HighTechTalks DotNet Forums  

Returning an IEnumerator from a ServicedComponent

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss Returning an IEnumerator from a ServicedComponent in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jo Siffert
 
Posts: n/a

Default Returning an IEnumerator from a ServicedComponent - 11-10-2004 , 06:28 AM






Hi all,

I have a question regarding EnterpriseServices: I have a serviced
component (see below) that returns an IEnumerator. This Enumerator
should be returned by reference, of course. Howeverm when I try ti run
the code below, I get the exception:

System.Runtime.Remoting.RemotingException : This remoting proxy has no
channel sink which means either the server has no registered server
channels that are listening, or this application has no suitable client
channel to talk to the server.

Stack Trace:
at System.Runtime.Remoting.Proxies.RemotingProxy.Inte rnalInvoke(
IMethodCallMessage reqMcmMsg,
Boolean useDispatchMessage, Int32 callType)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invo ke(
IMessage reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(
MessageData& msgData, Int32 type)
at System.Collections.IEnumerator.MoveNext()

Do I need to apply different attributes to the Enumerator class?

Thaks for your help,
Jo




The code:

< _
ClassInterface(ClassInterfaceType.None), _
Transaction(TransactionOption.Disabled), _
ComponentAccessControl(True), _
ConstructionEnabled(False), _
Description("Database Configuration"), _
EventTrackingEnabled(False), _
MustRunInClientContext(True), _
ObjectPooling(False), _
JustInTimeActivation(False), _
Synchronization(SynchronizationOption.Required) _
Quote:
_
Public Class FooManager
Inherits ServicedComponent
Implements IFooManager


' ...

Function List( _
ByVal parentId As Int32 _
) As IEnumerator Implements IFooManager.List
Return New FooEnumerator(parentId, m_dbCfg)
End Function

End Class

< _
ComVisible(True), _
ClassInterface(ClassInterfaceType.None) _
Quote:
_
Public Class FooEnumerator
Inherits MarshalByRefObject
Implements IEnumerator

'...

End Class



Reply With Quote
  #2  
Old   
Robert Jordan
 
Posts: n/a

Default Re: Returning an IEnumerator from a ServicedComponent - 11-10-2004 , 06:51 AM






Hi Jo,

Quote:
I have a question regarding EnterpriseServices: I have a serviced
component (see below) that returns an IEnumerator. This Enumerator
should be returned by reference, of course. Howeverm when I try ti run
the code below, I get the exception:

System.Runtime.Remoting.RemotingException : This remoting proxy has no
channel sink which means either the server has no registered server
channels that are listening, or this application has no suitable client
channel to talk to the server.
Your enumerator must be derived from ServicedComponent.

bye
Rob


Reply With Quote
  #3  
Old   
Tomas Restrepo \(MVP\)
 
Posts: n/a

Default Re: Returning an IEnumerator from a ServicedComponent - 11-10-2004 , 05:29 PM



Jo,

Quote:
I have a question regarding EnterpriseServices: I have a serviced
component (see below) that returns an IEnumerator. This Enumerator
should be returned by reference, of course. Howeverm when I try ti run
the code below, I get the exception:

System.Runtime.Remoting.RemotingException : This remoting proxy has no
channel sink which means either the server has no registered server
channels that are listening, or this application has no suitable client
channel to talk to the server.

Stack Trace:
at System.Runtime.Remoting.Proxies.RemotingProxy.Inte rnalInvoke(
IMethodCallMessage reqMcmMsg,
Boolean useDispatchMessage, Int32 callType)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invo ke(
IMessage reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(
MessageData& msgData, Int32 type)
at System.Collections.IEnumerator.MoveNext()

Do I need to apply different attributes to the Enumerator class?
Wouldn't make a difference; you're design doesn't lend to what you're trying
to do.

To actually get an enumerator to marshal by ref it would need to derive
somehow from MarshalByRefObject (usually done in your case by creating a
ServicedComponent-derived class).

So, in other words, this won't work anyway.

Seems to me, without knowing the full details of what you want to do, that a
much better option would be to return a *value* object (*not* a value type,
but a type that marshals by value and is [Serializable]) that implemented
IEnumerable, and contained an implementation of IEnumerator that was created
and executed in the *client* context by calling into a serviced component to
get the data on each call to IEnumerator::Next().

--
Tomas Restrepo
tomasr (AT) mvps (DOT) org




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.