Accessing a nested Property as a comparison in a Where clause throws a NotSupportedException

Issue #151 resolved
Chris Skardon created an issue

From: http://stackoverflow.com/questions/19111052/node-byindexlookup-and-where-clause-throwing-exception

If you have a nested class, like so:

public class User { public Address Address { get;set; } }
public class Address { public string Country { get;set; } }

var instance = new User { Address = new Address { Country = "UK" } };

and you try to use this instance in a .Where clause:

.Where((Foo foo) => foo.Country == instance.Address.Country)

Neo4jClient will throw a NotSupportedException. I think this is a case that happens, albeit not that frequently, and could be supported.

A workaround is to copy the 'nested' bit to another variable:

var address = instance.Address;
/* start etc */
.Where((Foo foo) => foo.Country == address.Country);

Comments (1)

  1. Log in to comment