I have the following Neo4jClient Cypher query:
public TModel Update(TModel model)
{
return GraphClient.Cypher.Match(string.Format("(e:{0})", typeof(TModel).Name))
.Where<IEntity>(e => e.Id == model.Id)
.Set("e = {model}")
.WithParam("model", model)
.Return(e => e.As<TModel>())
.Results
.Single();
}
This method gets a model and updates an existing one by using the Id of it.
This method is part of a generic repository which also has a Save(), GetAll(), GetById() in the same manner. However, the update method for the following reason fails:
NotSupportedException is thrown with message:
Unhandled node type MemberAccess in MemberExpression: Convert(value(Refugee.DataAccess.Neo4j.Repository.Neo4jRepository`1+<>c__DisplayClass2[Refugee.DataAccess.Graph.Models.Refugee]).model).Id
The problem was very bizarre. I had to store the model.Id in a temporary variable inside the method and then use the temporary variable to the lambda expression in order to make it work.