Can't you use the null object pattern to have an object there already?
It makes sense that the Data Binder cannot help you because how is it
supposed to know which implementation of the abstract class to
instantiate. If that does not work for you, you could always extend
the Binder component to meet your needs.
On Sep 10, 7:24 pm, "Jan Limpens" <[EMAIL PROTECTED]> wrote:
> now I am doing this:
> // themeFromForm has no Kit, etc.. because they are abstract
> Articles, databind cannot create
> // so i need to get these manually
> themeFromDb.Kit = ArticleDao.GetById(getId("theme.Kit.Id"));
> themeFromDb.AdditionalGuestKit =
> ArticleDao.GetById(getId("theme.AdditionalGuestKit.Id"));
> themeFromDb.AdditionalDecoration =
> ArticleDao.GetById(getId("theme.AdditionalDecoration.Id"));
> themeFromDb.PartyFavor =
> ArticleDao.GetById(getId("theme.PartyFavor.Id"));
>
> not too elegant. I guess it is here where active record really kicks
> the llamas ass :)
>
> any good ideas?
>
>
>
> On Wed, Sep 10, 2008 at 7:22 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
> > cought it! theme.Kit is of an abstract baseclass.
> > now i wonder how i come around this, because from a domain point of
> > view, this is absolutely correct.
>
> > On Wed, Sep 10, 2008 at 6:27 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
> >> Hi folks,
>
> >> I generate a control like that
> >> ${FormHelper.Select("theme.Kit.Id", sets, [EMAIL PROTECTED]:"Id",
> >> @text:"Name",
> >> @firstoption:"Sem Kit", @firstoptionvalue:''})}
>
> >> It gets populated and the right item is selected
>
> >> I post it to this action
> >> public void Save([DataBind("theme")] Theme themeFromForm)
>
> >> In my Params["theme.Kit.Id"] shows the correct value.
> >> but
> >> themeFromForm.Kit is null
>
> >> this happened recently and without changing code that should be able
> >> to affect this (which probably means, that's exactly what happened, I
> >> just don't know yet). Did something spooky happen the Databind?
>
> >> --
> >> Jan
> >> ___________________
> >> [EMAIL PROTECTED]
> >>www.limpens.com
> >> +55 (11) 3082-1087
> >> +55 (11) 3097-8339
>
> > --
> > Jan
> > ___________________
> > [EMAIL PROTECTED]
> >www.limpens.com
> > +55 (11) 3082-1087
> > +55 (11) 3097-8339
>
> --
> Jan
> ___________________
> [EMAIL PROTECTED]
> +55 (11) 3082-1087
> +55 (11) 3097-8339
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---