If a persistent object has a string property that maps to a nullable database column, binding that property to a Windows Forms control will cause an exception to be thrown if the property is null (see http://nhibernate.sourceforge.net/forum/viewtopic.php?t=30).
A value-type NullableString wrapper for System.String could be used to bind a nullable string column to a control.
Description
If a persistent object has a string property that maps to a nullable database column, binding that property to a Windows Forms control will cause an exception to be thrown if the property is null (see http://nhibernate.sourceforge.net/forum/viewtopic.php?t=30).
A value-type NullableString wrapper for System.String could be used to bind a nullable string column to a control.
Donald Mull - 30/May/05 07:13 PM I have a solution for that that I use.
1. In the code for your class, start the string off as a zero length string
ex:
public class MyObject
{
string name = string.Empty;
}
2. Use a usertype to store and empty string as null in the database and read null as an empty string..
I'll post my user type tomorrow when I get to work. I'll add it to the contrib (probably Nullable.NHibernate as an implementation of IType).
1. In the code for your class, start the string off as a zero length string
ex:
public class MyObject
{
string name = string.Empty;
}
2. Use a usertype to store and empty string as null in the database and read null as an empty string..
I'll post my user type tomorrow when I get to work. I'll add it to the contrib (probably Nullable.NHibernate as an implementation of IType).