Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用Neo4jClient动态添加节点的属性?_C#_Neo4j_Neo4jclient - Fatal编程技术网

C# 如何使用Neo4jClient动态添加节点的属性?

C# 如何使用Neo4jClient动态添加节点的属性?,c#,neo4j,neo4jclient,C#,Neo4j,Neo4jclient,我想使用Neo4jClient动态添加节点的标签和属性 我试图像下面的代码一样解决它,但它不起作用 client.Cypher .Create("(person:Type)") .WithParam("Type", "Vegetable") .Set("person.property= \"zhai\"") .WithParam("propert

我想使用Neo4jClient动态添加节点的标签和属性 我试图像下面的代码一样解决它,但它不起作用

        client.Cypher
                 .Create("(person:Type)")
                 .WithParam("Type", "Vegetable")
                 .Set("person.property= \"zhai\"")
                 .WithParam("property", "name")
                 .ExecuteWithoutResults();
我的模型是

class Data
{
        public Data()
        {
            properties = new Hashtable();
        }

        private string type;

        public string Type
        {
            get { return type; }
            set { type = value; }
        }

        private Hashtable properties;

        public Hashtable Properties
        {
            get { return properties; }
            set { properties = value; }
        }

    }
我想将数据的属性导入节点的属性。
Thx Z.Tom

好的,首先,
Neo4j
默认情况下不支持
字典
元素(如
哈希表
),因此您需要一个自定义序列化程序,如本问题中的序列化程序:

知道了这一点,您就无法按您尝试的方式设置
属性
哈希表中的值。这是不可能的

现在,让我们来看看
Cypher

所以,塞弗-我不是100%确定你想做什么,但我想这就是你想要的:

var data = new Data{Type="Vegetable"};
data.Properties.Add("name", "zhai");

client.Cypher
    .Create("(person {personParam})")
    .WithParam("personParam", data)
    .ExecuteWithoutResults();
这将把节点放入数据库,但是您将无法通过
属性中的任何值进行查询


我认为您应该花一点时间阅读Cypher手册,以了解您正在尝试做什么,因为我认为这会让您走得更远。

好的,首先,
Neo4j
默认情况下不支持
字典
元素(如
哈希表
),因此您需要一个自定义序列化程序,例如这个问题中的一个:

知道了这一点,您就无法按您尝试的方式设置
属性
哈希表中的值。这是不可能的

现在,让我们来看看
Cypher

所以,塞弗-我不是100%确定你想做什么,但我想这就是你想要的:

var data = new Data{Type="Vegetable"};
data.Properties.Add("name", "zhai");

client.Cypher
    .Create("(person {personParam})")
    .WithParam("personParam", data)
    .ExecuteWithoutResults();
这将把节点放入数据库,但是您将无法通过
属性中的任何值进行查询


我认为你应该花一点时间阅读密码手册,了解你想做什么,因为我认为这会让你走得更远。

谢谢,克里斯~,它非常有用谢谢,克里斯~,它非常有用