Thanks everyone for all the help.

On Feb 19, 1:58 am, Fabio Maulo <[email protected]> wrote:
> sorry
> access="field.camelcase-underscore"
>
> 2010/2/18 Fabio Maulo <[email protected]>
>
>
>
>
>
> > Good tip.
> > btw the mapping should be to the property; for the provided example it look
> > as:
> > <property name="Column" access="camelcase-underscore"/>
>
> > 2010/2/18 Mohamed Meligy <[email protected]>
>
> > I think the simplest way to implement this (regardless of whether it's
> >> right thing or what reasons make you ask for it) is to map a nullable enum
> >> FIELD, and make a property (that is NOT mapped in NH), which reads and
> >> writes the field value.
>
> >> something like:
> >> *
> >> *
> >> *//Mapped in NH, nullable
> >> private EnumType? _column;
>
> >> //MOT mapped in NH
> >> public EnumType Column
> >> {
> >> *
> >> *get
> >> {
> >> *
> >> *if(_column.GetValueOrDefault() == EnumType.None) //if null or none
> >> *
> >> *return EnumType.None;
> >> *
> >> *return _column;
> >> *
> >> *}
> >> set
> >> {
> >> *
> >> *if(value == EnumType.None)
> >> *
> >> *_column = null;
> >> *
> >> *_column = value;
> >> *
> >> *}
> >> *
> >> *}
> >> *
>
> >> --
> >> Mohamed Meligy
> >> Senior Developer, Team Lead Backup (.Net Technologies - TDG -
> >> Applications)
> >> Injazat Data Systems
> >> P.O. Box: 8230 Abu Dhabi, UAE.
>
> >> Phone:  +971 2 6992700
> >> Direct:   +971 2 4045385
> >> Mobile:  +971 50 2623624, +971 55 2017 621
>
> >> E-mail: [email protected]
> >> Weblog:http://gurustop.net
> >> Sent from Dubai, United Arab Emirates
>
> >> On Thu, Feb 18, 2010 at 2:41 PM, Diego Mijelshon 
> >> <[email protected]>wrote:
>
> >>> In any case, you should use a nullable enum property instead of a "NONE"
> >>> value.
> >>> My impression is that you are designing your domain based on display
> >>> concerns.
>
> >>>    Diego
>
> >>> On Thu, Feb 18, 2010 at 00:46, Fabio Maulo <[email protected]> wrote:
>
> >>>> IUserType if you have time to implements it otherwise just keep 0 and 1
> >>>> since MyEnum is different than MyEnum?
>
> >>>> I would know who said that 0 = null.
>
> >>>> 2010/2/17 Peter4922 <[email protected]>
>
> >>>> Hi,
>
> >>>>> I have a table with requests and a corresponding request class.
>
> >>>>> A request has a property called Type which is a C# enumeration.
> >>>>> Possible types are NONE=0, TRICKLEFEED=1, etc.
>
> >>>>> When the type is NONE the value 0 is stored in the database. For
> >>>>> TRICKLEFEED 1 is stored in the DB.
>
> >>>>> How can I setup NHibernate to map null in the database to type NONE
> >>>>> (the database column does allow null values). I could use
> >>>>> ICompositeUserType but that seems overkill of this situation.
>
> >>>>> Any suggestions ... ?
>
> >>>>> Kind Regards
>
> >>>>> Peter
>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google
> >>>>> Groups "nhusers" group.
> >>>>> To post to this group, send email to [email protected].
> >>>>> To unsubscribe from this group, send email to
> >>>>> [email protected]<nhusers%[email protected]
> >>>>>  >
> >>>>> .
> >>>>> For more options, visit this group at
> >>>>>http://groups.google.com/group/nhusers?hl=en.
>
> >>>> --
> >>>> Fabio Maulo
>
> >>>>  --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "nhusers" group.
> >>>> To post to this group, send email to [email protected].
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected]<nhusers%[email protected]
> >>>>  >
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/nhusers?hl=en.
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "nhusers" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected]<nhusers%[email protected]
> >>>  >
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/nhusers?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "nhusers" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<nhusers%[email protected]
> >>  >
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > Fabio Maulo
>
> --
> Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to