views:

427

answers:

1

Hi there,

I have the following construct:

class Person {
 int Id;
 Foo fooObject;
}

class Foo {
 int Id;
 //some more properties - doesn't matter
}

the Database is quite simple for this example;

Table Person( int Id, int foo_Id)
Table Foo( int Id, some more properties...)

I often get a Person Object which contains an initialized Foo Object, which does not contain a value (Id for example is 0). In this case i want to save NULL to the databasefield Person.foo_Id.

I guess, I should use IUserType for this kind of conversion, but I just don't know how I should implement this with the custom Foo Class... Does anyone have experience in this topic? By the way, I'm using FluentNHibernate.

Thanks in advance!

A: 
References(x => x.fooObject).Nullable()
mxmissile

related questions