I know so far that a local variable or a local property can be used as an alias like so
ClassA _aliasA;
_session.QueryOver(x => x.ClassA, () => _aliasA);
or
ClassA AliasA { get; set; }
_session.QueryOver(x => x.ClassA, () => AliasA);
I want to know what other options are possible. Like, are properties of an external class a valid option?
class ClassGenericAliases
{
ClassA Class { get; set; }
}
_session.QueryOver(x => x.ClassA, () => ClassGenericAliases.ClassA);
Can statics be used as aliases?
Are there other options for declaring aliases?
I would recommend never using anything for an Alias outside of the scope of the method that uses the alias.
QueryOver is a strongly typed version of Criteria, in Criteria an alias was a string value.
But now it needs to assign the alias to a variable so we just create one for it:
From NHForge documentation, it says the following:
http://nhibernate.info/doc/nh/en/index.html#queryqueryover-aliases
So stick to just using a variable in the scope of the method.