Given this (HORRIBLE) object graph that I can't change
public class Email
{
public Email(string email) { ... }
//DO a bunch of worthless stuff
}
public interface IPer开发者_如何学Goson
{
Email Email{get;set;}
}
Does something like this exist?
Map(p => p.EmailAddress).Use(s => new EmailAddress(s));
Essentially the Person interface won't take a string and I don't own the Email class so I can't modify it...
Not sure about Fluent NHibernate, but you can create your own IUserType which will map from Email to string and vice versa. It's real easy: see this for an example.
It is called component and useful for mapping valuetypes like an emailaddress.
加载中,请稍侯......
精彩评论