all groups > dotnet distributed apps > october 2003 >
You're in the

dotnet distributed apps

group:

Object Oriented development and COM+


Object Oriented development and COM+ Paulo Monteiro
10/21/2003 2:28:17 PM
dotnet distributed apps: I have some doubts about object oriented development using
COM+.
To use COM+ my classes must inherits from
System.EnterpriseServices.ServicedComponent. With C# a
class can inherit only from one class. This means that I
can't have these classes:

public class Order
{
public virtual void Create()
{
// insert a record in orders table
}
}

public class SpecialOrder : Order
{
public void Create()
{
// create a order
base.Create();

// Process the special order by example
// approve the order. Insert another table.
this.Approve();
}
}

Any suggestions?
I think in use ADO.Net transactions but with this solution
I don't need COM+ for anything.

Thanks in advanced,

Paulo Monteiro
Re: Object Oriented development and COM+ Jay B. Harlow [MVP - Outlook]
10/22/2003 9:29:06 AM
Paulo,
I have not used COM+ a lot, however you should be able to have Order inherit
from ServicedComponent, then SpecialOrder inherit from Order.

using System.EnterpriseServices;

[quoted text, click to view]

What you cannot do is have SpecialOrder inherit from both ServicedComponent
& Order, as both of those are classes.

Hope this helps
Jay


[quoted text, click to view]

Re: Object Oriented development and COM+ Eric Johannsen
10/22/2003 11:17:17 PM
Just because the language doesn't provide a keyword for multiple inheritance
doesn't mean you can't use it.

First of all, you can implement as many interfaces as you need in addition
to inheriting from a base class. If you really need the functionality of
multiple base classes, use containment, i.e.

class Derived : MyBase, ISomeInterface, IAnotherInterface
{
private SomeOtherBaseClass b;
public void SomeMethodFromB()
{
b.SomeMethodFromB();
}
}

Not as perty as if the class provided a keyword for multiple inheritance,
but that should not limit you if you need to do it.

In your case you don't really seem to need multiple inheritance. Try this

public class Order : System.EnterpriseServices.ServicedComponent
{
// ...
}

public class SpecialOrder : Order
{
// ...
}

or am I missing something?

Eric

[quoted text, click to view]
Re: Object Oriented development and COM+ Jimmy Nilsson
10/23/2003 7:37:14 AM
Hi Paulo,

As I see it, you should see COM+ as something you might use in the Service
Layer, not something to use for fine grained objects. For example, the
overhead might be too high otherwise.

You say that you can use ADO.NET transactions instead, and therefore don't
need COM+. That's just fine of course. Only use COM+ if you need any of its
services!

Best Regards,
Jimmy
www.jnsk.se/weblog/
###

[quoted text, click to view]

Re: Object Oriented development and COM+ Ice
10/24/2003 6:28:36 AM
Great answers - I think the most important response is Jimmy's. You are
potentially using a SOA with a finely grained object. Bad mix. Whether you
use COM+ or not, I don't think you want to use an object like "order" in the
manner you have described.

ice
[quoted text, click to view]

AddThis Social Bookmark Button