如何让Neo4JClient执行批量插入
问题描述:
当运行以下代码时,我收到一个异常“CypherTypeException:包含混合类型的集合不能存储在属性中。” - 我做错了什么,需要改变什么才能使它工作?如何让Neo4JClient执行批量插入
var wordObjs = new List<object>();
foreach (string word in WordGroups.GetAllWords())
{
wordObjs.Add(new { Value = word});
}
GraphClient.Cypher
.Create("(word:Word {words})")
.WithParam("words", new { words = wordObjs})
.ExecuteWithoutResults();
答
一个解决方案是用一个具体的类
private class Value {
public string Value {get;set;}
}
,并使用new List<Value>()
相反,我认为客户端有您的List
的匿名性质的麻烦。
+0
它有点偏离no-模式的概念有点但它的作品,所以谢谢:) –
+0
问题不在于数据库无法处理它,而是更多的客户端本身,希望我们能够很快使用'动态'的东西应该得到的东西在这附近。 –
你试过改变var var wordObjs = new List