Extending LINQ to Nhibernate provider, in combination with Dynamic LINQ problem?

There are two, well defined, separate stages here.

There are two, well defined, separate stages here: Converting the dynamic (string) query into a static expression (done by the Dynamic Linq library) Parsing that into an HqlTree, then executing (done by Nbernate) Since you have determined that a static expression works well, the problem lies in 1. What happens if you do the following? Var results = Enumerable.Empty().AsQueryable(); string pId = "1"; results = results.

Where("Id.ToString(). Contains(@0)", pId); If it fails, you'll have confirmed it's a problem with Dynamic Linq alone (i.e. It doesn't support the expression you're feeding it), so you'll have to dig into it and patch it.

Semi-related: the ToStringGenerator looks useful; could you submit a patch for N http://jira.nhforge.org.

Thanks for your answer. I have done what you suggested and the query works fine (I mean it yields no results but the Expression inside the query is correctly generated). Something that I have noticed now comparing the 2 queries is that the Expression for the static one uses a Expression.

Constant with the variable (pId) value whereas the dynamic one uses the string value directly. Do you think this may have to do with the problem? – murki Jun 7 at 17:45 1 @murki: yes, it might be related.Gh-impedance expression trees are extremely fragile in their support for small variations.

Now, given this you have two paths: patching Dynamic Linq to emit an Expression. Constant, or patching Nbernate to support the usage emitted by Dynamic Linq. – Diego Mijelshon Jun 7 at 18:35.

Supposing the property Id of the class Project it's an Int32 try registering the corresponding Int32.ToString() method in your ToStringGenerator class. ... public ToStringGenerator() { SupportedMethods = new { ReflectionHelper. GetMethodDefinition(x => x.ToString()), ReflectionHelper.

GetMethodDefinition(x => x.ToString()), }; } ...

Yeah, it's an Int32, but I'd actually tried that before -and this is probably topic for another question, but: 1) if I put only object and int nothing changes in my error, 2) if I start putting more data types (e.g. DateTime), it throws an NhibernateException with the error "An item with the same key has already been added" when building the SessionFactory. – murki Jun 8 at 16:45 Ok thanks. After some investigation, N2, still in beta version, will have a built in ToString support in Linq.

– Nicola Tuveri Jun 8 at 18:53.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions