Ok, I know this is dev group, but this really is a dev question. So I have linq query like so:
.Where(p => p.ID == hh2.InternalUser.CurrentUser.Options.GetOptionValue(206).ToInt()) which is giving me the error: System.NotSupportedException: Int32 ToInt(System.String This is expected behavior since ToInt() is an extension method not registered with nhibernate. Although i shouldn't need to add a custom method generator for this as all of the data exists in memory and can be calculated in memory (this also worked in old linq provider) i tried adding a generator to handle the ToInt() and then it just complained about the GetOptionValue call. Now, I know what's happening: when the linq query is being parsed, it's not correctly identifying that piece of code as being able to be evaluated locally and replacing the call in the linq query with the value, the problem is i don't know why. and to make things worse, i've spent about 3 hours unsuccessfully trying to make a failing test. Now in NHibernate, there seems to be 2 places where this is done, before the query is ever parsed using the re-motion nominator (PartialEvaluatingExpressionTreeVisitor) and in the select clause visitor with the nominator. NHibernate's nominator is very similar to the one from matt warren's linq tutorial<http://blogs.msdn.com/b/mattwar/archive/2007/08/02/linq-building-an-iqueryable-provider-part-iv.aspx>though it is different, so it could be a problem with nhibernate's nominator, but at the same time this is in the where clause, not the select clause. I would guess that it would be re-motion's nominator that's missing it, but i don't know what their's looks like. So, anyone have a guess as to what might be causing this or where it might be happening? Maybe Fabian can chime in on the re-motion side. I know how to fix my code, but at the same time this is something that shouldn't be happening in the provider.
