How can I map a nullable value-type property as a component in NHibernate?
For example:
public struct PersonName
{
public string FirstName { get; private set; }
public string LastName { get; private set; }
public PersonName(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
}
public class Person
{
public PersonName? Name { get; set; }
}
public class PersonDbMap : ClassMap<Person>
{
public PersonDbMap()
{
/* This part doesn't compile! */
Component(x => x.Name,
part =>
{
part.Map(x => x.FirstName, "FirstName");
part.Map(x => x.LastName, "LastName");
}
}
}