In NHibernate, the following works perfectly fine:
Session.Get(repoType.ToString(), id))
But this:
Session.QueryOver(repoType.ToString(), func)
for some reason, does not. From the documentation, both methods take in the name of the entity as a string as the first parameter, but QueryOver complains with the following error message:
The type arguments for method 'NHibernate.ISession.QueryOver<T>(string, System.Linq.Expressions.Expression<System.Func<T>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
I'm fairly sure that this is being caused by the first parameter to QueryOver (the entityName parameter), and not the func parameter.
Why is it that ISession.Get can infer the entity type from the given entity name but ISession.QueryOver cannot?