-->
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: Nullable Types with nhibernate-1.0.2.0 and .NET 2.0
PostPosted: Tue May 30, 2006 5:57 pm 
Newbie

Joined: Tue May 30, 2006 5:50 pm
Posts: 6
Hello Everyone.

I just started using NHibernate a few days ago and I've been actively reading the online forums. I've seen a lot about "Nullable" types here and on many other forums. These posts have typically been rather old, more than 6 months.

What i would like to know is if there are any known issues with using the .NET 2.0 nullable types (e.g. int?). I've created a test case using a simple database table (MSSQL) and i can't produce any errors by creating, updating or getting an entity that has a nullable field.

Any information would be appreciated.

thanks!

_________________
-Beau


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 10:48 pm 
Regular
Regular

Joined: Mon May 16, 2005 1:35 am
Posts: 67
.NET 2.0 nullable types are fine to use. If using NHibernate 1.0.2 you just need to specify the type attribute in your property definitions.

So for a nullable DateTime,

<property name="MyProperty" type="DateTime" />

And then just declare your property as:

public DateTime? MyProperty { get; set; }

The type attribute needs to be specified only because NH 1.0.2 doesn't understand how to infer nullable types by reflection.


Top
 Profile  
 
 Post subject: Excellent News
PostPosted: Tue May 30, 2006 11:00 pm 
Newbie

Joined: Tue May 30, 2006 5:50 pm
Posts: 6
Thank you very much.

This confirms my test and definitely opens up the door for some NHibernate usage internally.

Thanks again!

_________________
-Beau


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.