I would suggest to use an interface.

Anyway ask yourself who need use that interface (or the GetList method from
the abstract base class) without knowing which is the actual object type.
If you are planning to write code that implements services/functions for all
your BO classes (derived from the Business Object Abstract Class and/or that
implement the interfaces you provided) it make sense to have an abstract
base class or interfaces. If you do not (and probably you don't for  GetList
methods because when you want to apply a filter  you need criteria that are
specific to a single BO so you will need specific methods or you will need
to give up type-safe programming), your problem is a problem of programming
style, you just want that all BO code in your project follow a pattern.
In this case you could:
- just define a clear pattern and ask all the programmers to follow it
- use a code generator (something like Gen<X>)
- when C# will have generic programming you could define a template and use
it as a trait (for  GetList kind methods)


HTH (luKa)
http://dev.luca.minudel.it

P.S. Maybe these links interest you for implement your Business Object
Abstract Class:
- An Oid struct implementtion (I cn give NUnit tests if you need)
http://www.eurosystem.it/ancom/v1/ANCOM-INS-NEW/ViewSourceCode.AspX?path=Riepilogo.src&file=..\IdentityAndPersistence\Identity.cs&font=14
- An Oid Factory

http://www.eurosystem.it/ancom/v1/ANCOM-INS-NEW/ViewSourceCode.AspX?path=Riepilogo.src&file=..\IdentityAndPersistence\OidFactory.cs&font=14
- A persistent Object base class

http://www.eurosystem.it/ancom/v1/ANCOM-INS-NEW/ViewSourceCode.AspX?path=Riepilogo.src&file=..\IdentityAndPersistence\Persistence.cs&font=14
- CRUD methods signature
  http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/ejb/EntityBean.html
- IsNew, IsXXX methods signature
http://java.sun.com/products/jdo/javadocs/javax/jdo/JDOHelper.html



On Tue, 24 Jun 2003 20:38:20 -0400, Michael Wolfenden
<[EMAIL PROTECTED]> wrote:

>I have a problem that I would appreciate any help with.
>
>I am creating a Business Object Abstract Class that all the business
>objects in my application with inherit. This class contains common
>functionality such as getting a business object given a unique identifier,
>providing IsDirty - IsNew methods etc....
>
>The problem is that I want each business object to implements a shared
>function GetList which will return a HashTable of all of those business
>objects for populating list boxes etc...
>
>If I could provide this method in the Business Object Abstract Class or
>define an Interface with this method then I could create a generic routine
>to populate a list box for a Business Object. However as you know, you
>cannot declare a shared method in an interface, and you cannot declare a
>shared must override method in an Abstract Class.
>
>I don't understand why this restriction exists or how I can get around it.
>All I can do is implement this method in each of the subclasses of the
>Abstract Class, however there is no contract forcing other developers to
>implement this method.
>
>Once again any help would be much appreciated, for this has bugged me no
>end

Reply via email to