Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM+ & .NET components: use remoting or serialization

Status
Not open for further replies.

gdrenfrew

Programmer
Joined
Aug 1, 2002
Messages
227
Location
GB
Hello,

I have an application written in C#. Each component is compiled into a ServicedComponent so I can put it in COM+.

However, since I have given my component assemblies strong names, I now receive serialization errors when I try and pass classes between methods in separate assemblies.

If I implement serialization of all my classes, will this work in COM+? Or should I implement remoting for all my assemblies? I am v. confused about this issue.

My initial object will be called from an ASP page, and then that object will instatiate all the other ones. No standard COM objects have to interact with my .NET assemblies.


Thanks if anyone can shed some light on the direction to go.
 
The binary serializer in the v1.1 framework includes the full name of the class/assembly that produced it. What you can do is separate the classes that are being serialized into their own assembly, and then deploy that assembly on both layers. That way the sender can use it, and the receiver can also use it. The only catch is that you can't let the two machines get out of sync.

The v2.0 framework is a little more liberal. There was a good article on this in last month's MSDN magazine.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks Chip

After reading on serialization all day, your reply is still a bit too advanced for me. Is serialization the only way for .NET components to communicate in COM+?

If I have a serializable object in COM+, how do I pass it a parameter from ASP?

Thanks
 
Divide your classes up into three areas:

1) Classes that call another class to do the work (this is your ASP form calling your COM+ component)

2) Classes that get called by another class (your COM+ component being called by your ASP form or other caller)

3) Classes which represent the message being passed between them.

By separating out #3 into their own assembly you gain better control over the versioning, and thus the binary representation that gets passed when it's being remoted.

Your COM+ components would accept an object from #3 as an argument.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Hi Chip

This is pretty much what I've done.

Simplified:
1) Asp form (currently TestHarness in C# in development)
2) ProcessOrder and PlaceOrder components
3) Class representing the Order object. All my COM+ components (.NET Assemblies) pass Order objects about.
All these assemblies are currently in development in the IDE as one solution.

Going by your second last statement, are you suggesting I used Remoting?

All components will be living on the same machine, in COM+.(Except the calling point - asp page/testharness)

To pass the Order objects between ProcessOrder and PlaceOrder I have to serialize the object class?

To call 2) from 1) do the .NET components (ProcessOrder and PlaceOrder) have to be Serializable also?

I'm sort of at a loss because at present I can only instantiate ProcessOrder - I cannot seem to pass a string (not even an Order object) to its Initialise method. I thought this was because I had to serialize all my classes and objects to get them to run in COM+? Perhaps I've gone down the wrong blind alley!

Thanks again for your time Chip, it's very much appreciated.
Graeme
 
Maybe you're overcomplicating things. Serialization should happen automatically -- all you should have to do is just pass your Order object and the runtime will take care of it for you.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
OK Chip thanks. I'll take a couple of days away from it and go back fresh. Think I was chasing down too many blind alleys. Will post an update later in the week if anyone is reading this thread.

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top