У меня есть следующая модель домена:
public class Name
{
private readonly string fullName;
public Name(string fullName) { this.fullName = fullName }
public string FullName { get { return fullName; } }
public string FirstName { get { /* ... */ } }
public string MiddleNames { get { /* ... */ } }
public string LastName { get { /* ... */ } }
public static implicit operator Name(string name) { /* ... */ }
}
public class Person
{
public Name BirthName { get; set; }
public Name Pseudonym { get; set; }
}
Я реализовал IUserType
, поэтому я могу сопоставить каждый имя в один столбец базы данных с полным именем.
Запросы, подобные этой, работают:
var people = session.QueryOver<Person>()
.Where(p => p.Name == "John Doe")
.List();
Но я не могу делать такие запросы:
var people = session.QueryOver<Person>()
.Where(p => p.Name.LastName == "Doe")
.List();
Могу ли я заставить NHibernate работать с этим?