NHibernate Merge problem with XMLType -


i have class contains property of type xmlelement. property mapped following:

<property name="xamlform" column="xamlform" type="ktn.base.data.types.xmltype, ktn.base.data" /> 

the xmltype class:

[serializable] public class xmltype : iusertype {     public new bool equals(object x, object y)     {         xmlelement xdoc_x = (xmlelement)x;         xmlelement xdoc_y = (xmlelement)y;          if (xdoc_x == null && xdoc_y == null) return true;          if (xdoc_x == null || xdoc_y == null) return false;          return xdoc_y.outerxml == xdoc_x.outerxml;     }      public object nullsafeget(idatareader rs, string[] names, object owner)     {         if (names.length != 1)             throw new invalidoperationexception("names array has more 1 element. can't handle this!");         xmldocument document = new xmldocument();         string val = rs[names[0]] string;         if (val != null)         {             document.loadxml(val);              return document.documentelement;         }         return null;     }      public void nullsafeset(idbcommand cmd, object value, int index)     {         dbparameter parameter = (dbparameter)cmd.parameters[index];         if (value == null)         {             parameter.value = dbnull.value;             return;         }         parameter.value = ((xmlelement)value).outerxml;     }      public object deepcopy(object value)     {         if (value == null) return null;         xmlelement other = (xmlelement)value;         xmldocument xdoc = new xmldocument();         xdoc.loadxml(other.outerxml);         return xdoc.documentelement; /**/     }      public sqltype[] sqltypes     {                 {             return new sqltype[] { new sqlxmltype() };         }     }      public system.type returnedtype     {         { return typeof(xmldocument); }     }      public bool ismutable     {         { return true; }     }      public object assemble(object cached, object owner)     {         return cached;     }      public object disassemble(object value)     {         return value;     }      public int gethashcode(object x)     {         return x.gethashcode();     }      public object replace(object original, object target, object owner)     {         // changed return original return target...          return target;     }  } 

after invoke function merge nhibernate, property null. idea? in advance

nhibernate 3 has out of box types both xdocument , xmldocument.

you shouldn't need roll own.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -