Re: subclass with static constructor
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Sat, 14 Mar 2009 18:33:40 -0700
On Sat, 14 Mar 2009 18:21:16 -0700, John A Grandy <johnagrandy@g-mail-dot-com> wrote:
Here is what I'm attempting to accomplish ( and I am agnostic as to the implementation details ).
I have a variety of data-access functionality , meant to be accessed statically.
Why statically? Is that a firm requirement? If it's meant to be accessed statically, how does the fact that your base class has instance members (I'm assuming it does, since you are inheriting it, and you can't inherit a static class) fit into that?
From your description, it seems to me that you have an inheritance relationship between the functionality. But you can only inherit with instances. So, why not just make the classes instantiable? If you want to ensure only one instance per database, then you can use the singleton pattern to ensure that.
It seems to me that the closest next alternative would be to replicate the entire general-purpose API found in the base class, as static members in the database-specific classes. Then those members can delegate the general-purpose functionality to the base class. But, this is a pretty awkward approach IMHO...it requires a lot of extra work, for no apparent benefit that I can see.
Pete
.
- Follow-Ups:
- Re: subclass with static constructor
- From: John A Grandy
- Re: subclass with static constructor
- References:
- subclass with static constructor
- From: John A Grandy
- Re: subclass with static constructor
- From: Peter Duniho
- Re: subclass with static constructor
- From: John A Grandy
- subclass with static constructor
- Prev by Date: Re: Removing rows from two connected tables
- Next by Date: Re: Dictionary<string, string>
- Previous by thread: Re: subclass with static constructor
- Next by thread: Re: subclass with static constructor
- Index(es):
Relevant Pages
|