I'm using Fluent NHibernate (Auto Mapping) to map my domain objects to database tables. I've created my own 'Date' class which I map using 'DateTranslator' - an implementation of NHibernate's 'IUserType'.
public class MyDomainObject : DomainObject
{
public Date Date { get; set; }
}
public class MyDomainObjectMappingOverride : IAutoMappingOverride<MyDomainObject>
{
public void Override(AutoMapping<MyDomainObject> mapping)
{
mapping.Map(x => x.Date).CustomType(typeof(DateTranslator));
}
}
As you can see - I've created a mapping override for this domain object so that I can specify the custom type that should be used to map the 'Date' property.
Now - this means that I'll have to create a mapping override for all domain objects that contain a property of type 'Date'.
I'd like to use a convention here so that 'DateTranslator' will be used to map all properties of type 'Date' but I've been unable to figure it out.
Any help with this would be greatly appreciated.