Geeks With Blogs
Mike Nichols - SonOfNun Technology If I were the captain on a big steamboat...

I needed to implement a component that uses generic parameters. Documentation is sketchy on NHibernate so thot I'd jot it here. I *stole* an IRange implementation from someone and needed to use it for a date range within a class.

    <component name="DateTimeRange" class="Cei.eMerge.Common.Range`1[System.DateTime], Cei.eMerge.Common" access="field.camelcase-underscore" >

      <property name="Start" access="field.camelcase">

        <column name="StartDate" not-null="true" />

      </property>

      <property name="End" access="field.camelcase">

        <column name="EndDate" not-null="true"/>

      </property>

    </component>

Note the `[genericTypeParameter] syntax. Here's how we map it. Be sure you have a default constructor! The exceptions thrown by NOT having a default constructor are riddles at best.

Posted on Sunday, September 24, 2006 8:36 PM O/R Mappers | Back to top


Comments on this post: NHibernate Class Mapping With Generic Parameters

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Mike Nichols | Powered by: GeeksWithBlogs.net