-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: IUserType Changes in 1.2.0.CR1 (Examples???)
PostPosted: Tue Feb 27, 2007 6:41 am 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
I am trying to port some code to NHibernate 1.2.0.CR1 and I have to update a custom user type I created. There are 3 new methods that are required: Replace, Assemble, and Disassemble. Are there any examples to show what logic to put in these methods?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 7:31 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
XML comments of IUserType say what the default implementation can do. You can also look at the NHibernate sources to look how standard NH types are implemented.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 7:43 am 
Beginner
Beginner

Joined: Tue Nov 28, 2006 4:26 pm
Posts: 32
Location: Montreal, Quebec, Canada
Thanks. I did read the source comments before I posted, but I guess it was not so obvious to me. I ended up using the following:

Code:
public object Replace(object original, object target, object owner)
{
    return DeepCopy(original);
}
public object Assemble(object cached, object owner)
{
    return DeepCopy(cached);
}
public object Disassemble(object value)
{
    return DeepCopy(value);
}

I used the code from BFileType.cs in NHibernate.UserTypes.Oracle as an example.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.