VBA.CollectionClass ?

E

elizabeth

New to .NET and writing a C# ASP.Net application that needs to access
a COM+ VB dll (which I was not involved in writing). The COM+ VB dll
returns a VB Collection. I use VBA.CollectionClass to define my
return object. Everything works great but the question is (coming
from a C++ person): what exactly is this VBA.Collection? Is it going
to slow down the app. when we are in production? Would it better
faster to add a method to the COM+ VB dll that returns an XML string
w/ the data instead of a VB collection.

Thanks, Beth
 
V

Val Savvateev

I would not have any concerns about VB's Collection performance, especially
compared to the overhead of having data converted to text and the text being
sent/serialized...
 
C

codewriter

Definitely. XML string will faster. Less overhead.
The idea of returning objects from VB DLL is not good at all.
 
V

Val Savvateev

The idea of returning objects from VB DLL is not good at all.
Why is that? I would agree that it _might_ be a bad idea in _certain
configurations_, but usually it should work just fine.
 
V

Val Savvateev

That exactly what I mean. Marshalling of a collection should outperform your
manual process of converting stuff into XML / sending it back to the caller
(which is in a sense marshalling as well) / converting the XML back to
"normal" data.
 
C

codewriter

COM does not marshal objects, it marshals object references.
Therefore, COM does not move objects across the process boundaries.
Universal Marshaler creates a Proxy and a Stub.
Therefore, your statement:
"Marshalling of a collection should outperform your
manual process of converting stuff into XML / sending it back to the caller
(which is in a sense marshalling as well) / converting the XML back to
"normal" data."
does not make any sense.
 
V

Val Savvateev

codewriter said:
It definitely shows that you have very faint idea about COM marshaling.
*yawn*

Marshaling is a data transmission between processes.

In fact marshaling is "The act of passing the function calls and parameters
of an OLE object across process boundaries." according to MSDN. I would add
that in COM marshaling also occurs between apartments.
This means that your
calling object lives in one process and the caller in another.

See my previous remark....
If you return
a collection from a calling object and then use it in your caller, let's say
in a For Each loop, you will be marshaling your data every time you access
the collection.

Why should the caller and the callee be in different processes? We're
talking about ASP page and COM+ application... A COM+ application can be set
up to run in-proc.
Let's assume that you are using collection of objects each
of which has four properties, and you have 50 objects in your collection.
This will mean that in your For Each loop you will be making at least 200
trips across the process boundaries in case you want to retrieve all the
properties.
That was the whole purpose of creating serializers in .NET.

Alright. I see the light. Now we know the purpose of serializers in .NET,
people. :)

Seriously, nothing would hold you from implementing custom marshaling in
COM.... (Oh yeah, it may not be easy...)
You serialize
your object, let's say in XML string, and pass it to the caller. It is going
to be only one trip.
You should buy "Programming Distributed Applications with COM and Visual
Basic 6.0" fro Microsoft Press. It will help.

I prefer Don Box's books, thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top