简体   繁体   English

.NET只读模式的Neo4j驱动程序不起作用

[英]Neo4j Driver for .NET Readonly mode not working

I have problem with Neo4j Driver for .NET. 我对.NET的Neo4j驱动程序有疑问。
To execute query, i use session with ReadOnly mode and Read transaction, but still i can modify graph via query like: Match (n) where Id(n) = 123 set n.foo = 33 return n; 要执行查询,我使用具有只读模式的会话和Read事务,但是我仍然可以通过查询来修改图形,例如: Match (n) where Id(n) = 123 set n.foo = 33 return n;

My code: 我的代码:

using (var session = Driver.Session(AccessMode.Read))
        {
            session.ReadTransaction(tx =>
            {
                try
                {
                    var queryResult = tx.Run(job);
                }
                catch (Exception ex)
                {
                    errorMessage = ex.Message;
                }
            });
        }


Why is possible? 为什么可能呢? How resolve this problem? 如何解决这个问题?

The AccessMode.Read define the type of the session, and this is used only when you are on a cluster mode, to perform session's transactions on a replica server and not on a core server. AccessMode.Read定义会话的类型,仅当您处于集群模式时,才使用它来在副本服务器上而不是在核心服务器上执行会话的事务。

It doesn't not tell that your session is a readonly one. 它并不能说明您的会话是只读会话。

To have a pure read only access, you need to connect to Neo4j with a read only user. 要具有纯只读访问权限,您需要以只读用户身份连接到Neo4j。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM