History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: NH-279
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Sergey Koshcheyev
Reporter: Bill Hawes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
NHibernate

NullableString in Nullables

Created: 18/May/05 01:54 AM   Updated: 20/Sep/05 02:24 PM
Component/s: -------------
Affects Version/s: beta-0.8.3
Fix Version/s: 1.0-rc1

File Attachments: 1. Text File NullableStringType.cs (1 kb)



 Description  « Hide
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.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
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).

Sergey Koshcheyev - 23/Jul/05 12:35 PM
Delayed until 1.0, since it doesn't look that important and we would like to release 0.9 already.

Donald Mull - 30/Jul/05 06:25 PM
Here is the [rather delayed] class I was talking about.

Mike Doerfler - 01/Sep/05 08:49 PM
Added an EmptyAnsiStringType and EmptyStringType to the Nullables.NHibernate assembly.