This filter code works how I want it to (Loads only time tickets related to the currently logged in customer.) Two things worry me about it:
- Adding
collate Latin1_General_CI_ASto the column name. I’ve read other places NHibernate doesn’t support joining multiple collations, so I’m concerned about what the unintended side effects. this_1_: Will I always be able to rely on that table alias being used?
public class TimeTicketMap : ClassMap<TimeTicket>
{
public TimeTicketMap()
{
Id(x => x.TicketID).GeneratedBy.Identity();
Join("CONTRACTS", x =>
{
x.KeyColumn("CONTRACT collate Latin1_General_CI_AS");
Id(y => y.JobNumber).Column("Job");
x.Map(y => y.Customer);
});
ApplyFilter<CustomerFilter>("this_1_.Customer = :customer");
}
}
Can an expert in Fluent/NHibernate either talk me out of this, or grimace disapprovingly while telling me I likely won’t run into serious problems?
I ended up adding the collation to the Sql Dialect so it wouldn’t get treated as a column, and using an exists filter (Less efficient, but I know I can rely on it.)
with