ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: ResultMap with constructor injection
Date Tue, 18 Jul 2006 04:45:59 GMT
Nice.  Totally absent in Java land.

On 7/17/06, Ron Grabowski <rongrabowski@yahoo.com> wrote:
>
> System.Type instances have a GetConstructor() method which returns a
> System.Reflection.ConstructorInfo object. ConstructorInfo instances
> have a GetParameters() method which returns an array of ParameterInfo
> objects. Some of the properties on the ParameterInfo object are:
>
> Name:string
> ParameterType:Type
> Position:int
>
> --- Clinton Begin <clinton.begin@gmail.com> wrote:
>
> > Wow, I gotta read the docs.  :-)
> >
> > BTW: What's the "argumentName" attribute for? Can C# introspect on
> > the
> > argument names?
> >
> > Cheers,
> > Clinton
> >
> >
> > On 7/17/06, Ron Grabowski <rongrabowski@yahoo.com> wrote:
> > >
> > > DataMapper 1.5 supports this notation (IBATISNET-155):
> > >
> > > <resultMap id="account-result-constructor" class="Account" >
> > > <constructor>
> > >   <argument argumentName="id" column="Account_ID"/>
> > >   <argument argumentName="firstName" column="Account_FirstName"/>
> > >   <argument argumentName="lastName" column="Account_LastName"/>
> > > </constructor>
> > > </resultMap>
> > >
> > > --- Clinton Begin <clinton.begin@gmail.com> wrote:
> > >
> > > > In Java land I was thinking of simply adding the following to the
> > > > current
> > > > <result> element...
> > > >
> > > > Currently we can do:
> > > >
> > > >     <result property="FirstName" column="FIRST_NAME" />
> > > >
> > > > I'd like to add...
> > > >
> > > >     <result field="_firstName" column="FIRST_NAME"/>  <!-- I'm
> > not
> > > > advocating underscores -->
> > > >
> > > > ...and...
> > > >
> > > >     <result column="FIRST_NAME" />
> > > >
> > > > The latter (which lacks both property and field attributes) would
> > be
> > > > a
> > > > constructor parameter.  It would have to follow some rules:
> > > >
> > > >     1) Constructor results must come first in the result map
> > defn.
> > > >     2) Constructor results must be in the same order as the
> > > > parameters of
> > > > the constructor.
> > > >
> > > > I think constructor and field support would be awesome in both
> > the
> > > > .NET and
> > > > Java versions.
> > > >
> > > > Thoughts?
> > > >
> > > > Clinton
> > >
> >
>
>

Mime
View raw message