I am using Nhibernate with SQL server 2008.
I am trying to execute the following code:
var localization = session.QueryOver<T>()
.Where(idFilter).AndRestrictionOn(x => x.Language.IETFTag).IsLike(tag + "%").SingleOrDefault();
However, I get an exception on that line that says nhibernate cannot resolve property Language.IETFTag (or something to that effect).
I have tried using JoinQueryOver() but then it complains that I have multiple correlations in the FROM clause or something weird like that. It simply feels like I am doing something very wrong. How can I do what I want?
I have the following mapping:
internal class LocalizationMapping : ClassMap<Localization>
{
public LocalizationMapping()
{
UseUnionSubclassForInheritanceMapping();
Id(x => x.Id).GeneratedBy.HiLo("HiLo", "NextHi", "1000");
References(x => x.Language);
}
}
internal class LanguageMapping : ClassMap<Language>
{
public LanguageMapping()
{
Id(x => x.Id);
Map(x => x.DefaultName);
Map(x => x.IETFTag);
}
}
internal class ArticleLocalizationMapping : SubclassMap<ArticleLocalization>
{
public ArticleLocalizationMapping()
{
Map(x => x.Name);
Map(x => x.Description);
References(x => x.Article);
}
}