Re: How do I get EO's instantiated with dynamic class?
Re: How do I get EO's instantiated with dynamic class?
- Subject: Re: How do I get EO's instantiated with dynamic class?
- From: Riccardo De Menna <email@hidden>
- Date: Fri, 17 Aug 2007 17:46:59 +0200
Hi Guido,
I might have badly explained my issue. I have successfully used EO
inheritance in another context, but my aim here is exactly the
opposite. I don't want to model my DB with all sort of empty tables
for every possible domain ending (there are more than 200 different
country codes and such).
I'm perfectly fine with one single table holding domain info... I
simply want to fetch from it and receive specific subclasses of the
main "domain" class. These would simply differ from the common
superclass in the custom logic in them and NOT in the fields they
hold. Let's say for example that the DotCOM domain subclass would
validate domains up to 63 chars in length while the DotEU would start
bitching for anything longer than 25 or so, even though the table
holds any length.
That said I'm ordering Chuck's book anyway but it will take some time
to get my hands on it since I'm traveling through Europe atm.
If someone could simply tell me "you can't do it" or "you do it by
subclassing this" or such it would speed me up a lot...
Cheers,
Ric
On 17/ago/07, at 17:15, Guido Neitzer wrote:
On 17.08.2007, at 00:38, Riccardo De Menna wrote:
I was wondering if anyone could point me out in the right
direction on this problem of mine.
I'm writing a domain registration app and I have a model that
holds an entity "domain".
It's generic in nature as it will accomodate many different domain
endings (com net org eu etc).
Since I need to fit in a lot of custom behavior I was wondering if
I can force my editing context to retrieve data from the database
but then instantiate custom subclasses of a generic abstract
"domain" class (ie DotComDomain, DotNetDomain) instead of what I
provide in the model.
Is there a way to decide on the fly what class gets used to
generate fetched EO's?
You can use EOF inheritance (get Chuck's book to really learn how
to do it).
cug
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden