You can do something like this:
private string address;
public IPAddress Address{
get{
if(string.IsNullOrEmpty(ipAddress)) return null;
return new IPAddress(ipAddress.Split('.').ToArray().Select(s =>
byte.Parse(s)).ToArray());
}
set{ ipAddress = value.ToString(); }
}
In mappings:
<property name ="Address" access="field.camelcase" />
2010/9/12 alexey_baranov <[email protected]>
> I have read IUserType chapter in NHibernate Reference Documentation.
> We found it too less to understand how to use them within application.
> Can anybody share their IPAddress ICustomType provider and mapping? We
> will very apprishiate this.
>
> Thanks!
>
> On Sep 11, 10:42 pm, Tuna Toksoz <[email protected]> wrote:
> > IUserType
> >
> > Tuna Toksöz
> > Eternal sunshine of the open source mind.
> >
> >
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
> >
> > On Sat, Sep 11, 2010 at 12:34 PM, alexey_baranov <[email protected]>
> wrote:
> > > Hi!
> >
> > > I have a System.Net.IPAddress field in my NetworkEquipment class.
> > > What is the shortest way to map them and manage within NHibernate?
> >
> > > Thanks!
> >
> > > --
> > > 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]>
> <nhusers%[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].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.