Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'promontis/master'

BREAKING CHANGES
update Node AddToIndex to AddNodeToIndex
update Node Delete to DeleteNode
update Relationship AddToIndex to AddRelationshipToIndex
update Relationship Delete to DeleteRelationship
  • Loading branch information...
commit 46e1f6bde4dae5c1f0f713c1e68b4c2a0af8ec83 2 parents ddf8f04 + 3f1a1e9
@SepiaGroup authored
View
4 .gitignore
@@ -7,6 +7,8 @@ bin
Obj
Bin
TestResults
+_ReSharper
+*.vs10x
*.csproj.user
*.suo
*.scc
@@ -27,4 +29,4 @@ obj/
*.scc
*.ilk
*.ncb
-_ReSharper*
+_ReSharper*
View
16 Neo4jRestNet/CleanDbPlugin/CleanDbPlugin.cs
@@ -0,0 +1,16 @@
+using System.Configuration;
+using System.Net;
+
+namespace Neo4jRestNet.CleanDbPlugin
+{
+ public class CleanDbPlugin
+ {
+ private static readonly string _defaultDbUrl = ConfigurationManager.ConnectionStrings["neo4j"].ConnectionString.TrimEnd('/');
+ private static readonly string _cleanDbPluginPath = ConfigurationManager.ConnectionStrings["cleandb"].ConnectionString.TrimEnd('/');
+
+ public static HttpStatusCode CleanDb()
+ {
+ return Rest.HttpRest.Delete(string.Concat(_defaultDbUrl, _cleanDbPluginPath));
+ }
+ }
+}
View
112 Neo4jRestNet/Core/Node.cs
@@ -16,7 +16,7 @@ private enum NodeProperty
NodeType
}
- private static readonly string DefaultDbUrl = ConfigurationManager.ConnectionStrings["neo4j"].ConnectionString.TrimEnd('/');
+ private static readonly string _defaultDbUrl = ConfigurationManager.ConnectionStrings["neo4j"].ConnectionString.TrimEnd('/');
private string _dbUrl;
private string _self;
@@ -32,7 +32,7 @@ private enum NodeProperty
public static Node GetRootNode()
{
- return GetRootNode(DefaultDbUrl);
+ return GetRootNode(_defaultDbUrl);
}
public static Node GetRootNode(string dbUrl)
@@ -71,7 +71,7 @@ public static Node GetRootNode(string dbUrl)
public static Node GetNode(EncryptId nodeId)
{
- return GetNode(DefaultDbUrl, nodeId);
+ return GetNode(_defaultDbUrl, nodeId);
}
public static Node GetNode(string dbUrl, EncryptId nodeId)
@@ -88,22 +88,22 @@ public static Node GetNode(string dbUrl, EncryptId nodeId)
public static IEnumerable<Node> GetNode(string indexName, string key, object value)
{
- return GetNode(DefaultDbUrl, indexName, key, value);
+ return GetNode(_defaultDbUrl, indexName, key, value);
}
public static IEnumerable<Node> GetNode(Enum indexName, string key, object value)
{
- return GetNode(DefaultDbUrl, indexName.ToString(), key, value);
+ return GetNode(_defaultDbUrl, indexName.ToString(), key, value);
}
public static IEnumerable<Node> GetNode(string indexName, Enum key, object value)
{
- return GetNode(DefaultDbUrl, indexName, key.ToString(), value);
+ return GetNode(_defaultDbUrl, indexName, key.ToString(), value);
}
public static IEnumerable<Node> GetNode(Enum indexName, Enum key, object value)
{
- return GetNode(DefaultDbUrl, indexName.ToString(), key.ToString(), value);
+ return GetNode(_defaultDbUrl, indexName.ToString(), key.ToString(), value);
}
public static IEnumerable<Node> GetNode(string dbUrl, string indexName, string key, object value)
@@ -135,12 +135,12 @@ public static IEnumerable<Node> GetNode(string dbUrl, Enum indexName, Enum key,
public static IEnumerable<Node> GetNode(string indexName, string searchQuery)
{
- return GetNode(DefaultDbUrl, indexName, searchQuery);
+ return GetNode(_defaultDbUrl, indexName, searchQuery);
}
public static IEnumerable<Node> GetNode(Enum indexName, string searchQuery)
{
- return GetNode(DefaultDbUrl, indexName.ToString(), searchQuery);
+ return GetNode(_defaultDbUrl, indexName.ToString(), searchQuery);
}
public static IEnumerable<Node> GetNode(string dbUrl, string indexName, string searchQuery)
@@ -168,7 +168,7 @@ public static Node CreateNode(string nodeType)
{
var properties = new Properties();
properties.SetProperty(NodeProperty.NodeType.ToString(), nodeType);
- return CreateNodeFromJson(DefaultDbUrl, properties.ToString());
+ return CreateNodeFromJson(_defaultDbUrl, properties.ToString());
}
public static Node CreateNode(Enum nodeType)
@@ -190,7 +190,7 @@ public static Node CreateNode(string dbUrl, Enum nodeType)
public static Node CreateNode(string nodeType, Properties properties)
{
properties.SetProperty(NodeProperty.NodeType.ToString(), nodeType);
- return CreateNodeFromJson(DefaultDbUrl, properties.ToString());
+ return CreateNodeFromJson(_defaultDbUrl, properties.ToString());
}
public static Node CreateNode(Enum nodeType, Properties properties)
@@ -212,7 +212,7 @@ public static Node CreateNode(string dbUrl, Enum nodeType, Properties properties
public static Node CreateNode(string nodeType, IDictionary<string, object> properties)
{
properties.Add(NodeProperty.NodeType.ToString(), nodeType);
- return CreateNodeFromJson(DefaultDbUrl, JObject.FromObject(properties).ToString(Formatting.None));
+ return CreateNodeFromJson(_defaultDbUrl, JObject.FromObject(properties).ToString(Formatting.None));
}
public static Node CreateNode(Enum nodeType, IDictionary<string, object> properties)
@@ -247,7 +247,7 @@ private static Node CreateNodeFromJson(string dbUrl, string jsonProperties)
#region Delete
- public HttpStatusCode Delete()
+ public HttpStatusCode DeleteNode()
{
HttpStatusCode status = Neo4jRestApi.DeleteNode(_dbUrl, Id);
if (status != HttpStatusCode.NoContent)
@@ -537,35 +537,35 @@ public IEnumerable<IGraphObject> Traverse(Order order, Uniqueness uniqueness, IE
#region Index
- public static Node AddToIndex(long nodeId, string indexName, string key, object value)
+ public static Node AddNodeToIndex(long nodeId, string indexName, string key, object value)
{
- return AddToIndex(DefaultDbUrl, nodeId, indexName, key, value);
+ return AddNodeToIndex(_defaultDbUrl, nodeId, indexName, key, value);
}
- public static Node AddToIndex(long nodeId, Enum indexName, string key, object value)
+ public static Node AddNodeToIndex(long nodeId, Enum indexName, string key, object value)
{
- return AddToIndex(DefaultDbUrl, nodeId, indexName.ToString(), key, value);
+ return AddNodeToIndex(_defaultDbUrl, nodeId, indexName.ToString(), key, value);
}
- public static Node AddToIndex(long nodeId, string indexName, Enum key, object value)
+ public static Node AddNodeToIndex(long nodeId, string indexName, Enum key, object value)
{
- return AddToIndex(DefaultDbUrl, nodeId, indexName, key.ToString(), value);
+ return AddNodeToIndex(_defaultDbUrl, nodeId, indexName, key.ToString(), value);
}
- public static Node AddToIndex(long nodeId, Enum indexName, Enum key, object value)
+ public static Node AddNodeToIndex(long nodeId, Enum indexName, Enum key, object value)
{
- return AddToIndex(DefaultDbUrl, nodeId, indexName.ToString(), key.ToString(), value);
+ return AddNodeToIndex(_defaultDbUrl, nodeId, indexName.ToString(), key.ToString(), value);
}
- public static Node AddToIndex(string dbUrl, long nodeId, Enum indexName, Enum key, object value)
+ public static Node AddNodeToIndex(string dbUrl, long nodeId, Enum indexName, Enum key, object value)
{
- return AddToIndex(dbUrl, nodeId, indexName.ToString(), key.ToString(), value);
+ return AddNodeToIndex(dbUrl, nodeId, indexName.ToString(), key.ToString(), value);
}
- public static Node AddToIndex(string dbUrl, long nodeId, string indexName, string key, object value)
+ public static Node AddNodeToIndex(string dbUrl, long nodeId, string indexName, string key, object value)
{
string response;
- HttpStatusCode status = Neo4jRestApi.AddNodeToIndex(dbUrl, nodeId, indexName, key, value, out response);
+ var status = Neo4jRestApi.AddNodeToIndex(dbUrl, nodeId, indexName, key, value, out response);
if (status != HttpStatusCode.Created)
{
throw new Exception(string.Format("Error creating index for node (http response:{0})", status));
@@ -574,24 +574,24 @@ public static Node AddToIndex(string dbUrl, long nodeId, string indexName, strin
return InitializeFromNodeJson(response);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, string indexName)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, string indexName)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, Enum indexName)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, Enum indexName)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName.ToString());
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName.ToString());
}
- public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, Enum indexName)
+ public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, Enum indexName)
{
- return RemoveFromIndex(dbUrl, nodeId, indexName.ToString());
+ return RemoveNodeFromIndex(dbUrl, nodeId, indexName.ToString());
}
- public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, string indexName)
+ public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, string indexName)
{
- HttpStatusCode status = Neo4jRestApi.RemoveNodeFromIndex(dbUrl, nodeId, indexName);
+ var status = Neo4jRestApi.RemoveNodeFromIndex(dbUrl, nodeId, indexName);
if (status != HttpStatusCode.NoContent)
{
throw new Exception(string.Format("Error remove node from index (node id:{0} index name:{1} http response:{2})", nodeId, indexName, status));
@@ -600,34 +600,34 @@ public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, string i
return status;
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, string indexName, string key)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, string indexName, string key)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName, key);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName, key);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, Enum indexName, string key)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, Enum indexName, string key)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName.ToString(), key);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName.ToString(), key);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, string indexName, Enum key)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, string indexName, Enum key)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName, key.ToString());
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName, key.ToString());
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, Enum indexName, Enum key)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, Enum indexName, Enum key)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName.ToString(), key.ToString());
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName.ToString(), key.ToString());
}
- public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, Enum indexName, Enum key)
+ public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, Enum indexName, Enum key)
{
- return RemoveFromIndex(dbUrl, nodeId, indexName.ToString(), key.ToString());
+ return RemoveNodeFromIndex(dbUrl, nodeId, indexName.ToString(), key.ToString());
}
- public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, string indexName, string key)
+ public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, string indexName, string key)
{
- HttpStatusCode status = Neo4jRestApi.RemoveNodeFromIndex(dbUrl, nodeId, indexName, key);
+ var status = Neo4jRestApi.RemoveNodeFromIndex(dbUrl, nodeId, indexName, key);
if (status != HttpStatusCode.NoContent)
{
throw new Exception(string.Format("Error remove node from index (node id:{0} index name:{1} http response:{2})", nodeId, indexName, status));
@@ -636,29 +636,29 @@ public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, string i
return status;
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, string indexName, string key, object value)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, string indexName, string key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName, key, value);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName, key, value);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, Enum indexName, string key, object value)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, Enum indexName, string key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName.ToString(), key, value);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName.ToString(), key, value);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, string indexName, Enum key, object value)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, string indexName, Enum key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName, key.ToString(), value);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName, key.ToString(), value);
}
- public static HttpStatusCode RemoveFromIndex(long nodeId, Enum indexName, Enum key, object value)
+ public static HttpStatusCode RemoveNodeFromIndex(long nodeId, Enum indexName, Enum key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, nodeId, indexName.ToString(), key.ToString(), value);
+ return RemoveNodeFromIndex(_defaultDbUrl, nodeId, indexName.ToString(), key.ToString(), value);
}
- public static HttpStatusCode RemoveFromIndex(string dbUrl, long nodeId, string indexName, string key, object value)
+ public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, string indexName, string key, object value)
{
- HttpStatusCode status = Neo4jRestApi.RemoveNodeFromIndex(dbUrl, nodeId, indexName, key, value);
+ var status = Neo4jRestApi.RemoveNodeFromIndex(dbUrl, nodeId, indexName, key, value);
if (status != HttpStatusCode.NoContent)
{
throw new Exception(string.Format("Error remove node from index (node id:{0} index name:{1} http response:{2})", nodeId, indexName, status));
@@ -766,4 +766,4 @@ public override int GetHashCode()
#endregion
}
-}
+}
View
104 Neo4jRestNet/Core/Relationship.cs
@@ -12,7 +12,7 @@ namespace Neo4jRestNet.Core
{
public class Relationship : IGraphObject
{
- private static readonly string DefaultDbUrl = ConfigurationManager.ConnectionStrings["neo4j"].ConnectionString.TrimEnd('/');
+ private static readonly string _defaultDbUrl = ConfigurationManager.ConnectionStrings["neo4j"].ConnectionString.TrimEnd('/');
private string _dbUrl;
private string _self;
@@ -30,22 +30,22 @@ public class Relationship : IGraphObject
public static IEnumerable<Relationship> GetRelationship(string indexName, string key, object value)
{
- return GetRelationship(DefaultDbUrl, indexName, key, value);
+ return GetRelationship(_defaultDbUrl, indexName, key, value);
}
public static IEnumerable<Relationship> GetRelationship(Enum indexName, string key, object value)
{
- return GetRelationship(DefaultDbUrl, indexName.ToString(), key, value);
+ return GetRelationship(_defaultDbUrl, indexName.ToString(), key, value);
}
public static IEnumerable<Relationship> GetRelationship(string indexName, Enum key, object value)
{
- return GetRelationship(DefaultDbUrl, indexName, key.ToString(), value);
+ return GetRelationship(_defaultDbUrl, indexName, key.ToString(), value);
}
public static IEnumerable<Relationship> GetRelationship(Enum indexName, Enum key, object value)
{
- return GetRelationship(DefaultDbUrl, indexName.ToString(), key.ToString(), value);
+ return GetRelationship(_defaultDbUrl, indexName.ToString(), key.ToString(), value);
}
public static IEnumerable<Relationship> GetRelationship(string dbUrl, Enum indexName, Enum key, object value)
@@ -67,12 +67,12 @@ public static IEnumerable<Relationship> GetRelationship(string dbUrl, string ind
public static IEnumerable<Relationship> GetRelationship(string indexName, string searchQuery)
{
- return GetRelationship(DefaultDbUrl, indexName, searchQuery);
+ return GetRelationship(_defaultDbUrl, indexName, searchQuery);
}
public static IEnumerable<Relationship> GetRelationship(Enum indexName, string searchQuery)
{
- return GetRelationship(DefaultDbUrl, indexName.ToString(), searchQuery);
+ return GetRelationship(_defaultDbUrl, indexName.ToString(), searchQuery);
}
public static IEnumerable<Relationship> GetRelationship(string dbUrl, Enum indexName, string searchQuery)
@@ -295,35 +295,35 @@ public void SaveProperties(Properties properties)
#region Index
- public static Relationship AddToIndex(long relationshipId, string indexName, string key, object value)
+ public static Relationship AddRelationshipToIndex(long relationshipId, string indexName, string key, object value)
{
- return AddToIndex(DefaultDbUrl, relationshipId, indexName, key, value);
+ return AddRelationshipToIndex(_defaultDbUrl, relationshipId, indexName, key, value);
}
- public static Relationship AddToIndex(long relationshipId, Enum indexName, string key, object value)
+ public static Relationship AddRelationshipToIndex(long relationshipId, Enum indexName, string key, object value)
{
- return AddToIndex(DefaultDbUrl, relationshipId, indexName.ToString(), key, value);
+ return AddRelationshipToIndex(_defaultDbUrl, relationshipId, indexName.ToString(), key, value);
}
- public static Relationship AddToIndex(long relationshipId, string indexName, Enum key, object value)
+ public static Relationship AddRelationshipToIndex(long relationshipId, string indexName, Enum key, object value)
{
- return AddToIndex(DefaultDbUrl, relationshipId, indexName, key.ToString(), value);
+ return AddRelationshipToIndex(_defaultDbUrl, relationshipId, indexName, key.ToString(), value);
}
- public static Relationship AddToIndex(long relationshipId, Enum indexName, Enum key, object value)
+ public static Relationship AddRelationshipToIndex(long relationshipId, Enum indexName, Enum key, object value)
{
- return AddToIndex(DefaultDbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
+ return AddRelationshipToIndex(_defaultDbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
}
- public static Relationship AddToIndex(string dbUrl, long relationshipId, Enum indexName, Enum key, object value)
+ public static Relationship AddRelationshipToIndex(string dbUrl, long relationshipId, Enum indexName, Enum key, object value)
{
- return AddToIndex(dbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
+ return AddRelationshipToIndex(dbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
}
- public static Relationship AddToIndex(string dbUrl, long relationshipId, string indexName, string key, object value)
+ public static Relationship AddRelationshipToIndex(string dbUrl, long relationshipId, string indexName, string key, object value)
{
string response;
- HttpStatusCode status = Neo4jRestApi.AddRelationshipToIndex(dbUrl, relationshipId, indexName, key, value, out response);
+ var status = Neo4jRestApi.AddRelationshipToIndex(dbUrl, relationshipId, indexName, key, value, out response);
if (status != HttpStatusCode.Created)
{
throw new Exception(string.Format("Error creating index for relationship (http response:{0})", status));
@@ -332,24 +332,24 @@ public static Relationship AddToIndex(string dbUrl, long relationshipId, string
return InitializeFromRelationshipJson(response);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, string indexName)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, string indexName)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, Enum indexName)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, Enum indexName)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName.ToString());
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName.ToString());
}
- public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, Enum indexName)
+ public HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, Enum indexName)
{
- return RemoveFromIndex(dbUrl, relationshipId, indexName.ToString());
+ return RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName.ToString());
}
- public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, string indexName)
+ public HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, string indexName)
{
- HttpStatusCode status = Neo4jRestApi.RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName);
+ var status = Neo4jRestApi.RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName);
if (status != HttpStatusCode.NoContent)
{
throw new Exception(string.Format("Error remove relationship from index (relationship id:{0} index name:{1} http response:{2})", relationshipId, indexName, status));
@@ -358,34 +358,34 @@ public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, string
return status;
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, string indexName, string key)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, string indexName, string key)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName, key);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName, key);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, Enum indexName, string key)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, Enum indexName, string key)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName.ToString(), key);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName.ToString(), key);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, string indexName, Enum key)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, string indexName, Enum key)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName, key.ToString());
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName, key.ToString());
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, Enum indexName, Enum key)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, Enum indexName, Enum key)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName.ToString(), key.ToString());
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName.ToString(), key.ToString());
}
- public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, Enum indexName, Enum key)
+ public HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, Enum indexName, Enum key)
{
- return RemoveFromIndex(dbUrl, relationshipId, indexName.ToString(), key.ToString());
+ return RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName.ToString(), key.ToString());
}
- public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, string indexName, string key)
+ public HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, string indexName, string key)
{
- HttpStatusCode status = Neo4jRestApi.RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName, key);
+ var status = Neo4jRestApi.RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName, key);
if (status != HttpStatusCode.NoContent)
{
throw new Exception(string.Format("Error remove relationship from index (relationship id:{0} index name:{1} http response:{2})", relationshipId, indexName, status));
@@ -394,34 +394,34 @@ public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, string
return status;
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, string indexName, string key, object value)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, string indexName, string key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName, key, value);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName, key, value);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, Enum indexName, string key, object value)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, Enum indexName, string key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName.ToString(), key, value);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName.ToString(), key, value);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, string indexName, Enum key, object value)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, string indexName, Enum key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName, key.ToString(), value);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName, key.ToString(), value);
}
- public HttpStatusCode RemoveFromIndex(long relationshipId, Enum indexName, Enum key, object value)
+ public HttpStatusCode RemoveRelationshipFromIndex(long relationshipId, Enum indexName, Enum key, object value)
{
- return RemoveFromIndex(DefaultDbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
+ return RemoveRelationshipFromIndex(_defaultDbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
}
- public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, Enum indexName, Enum key, object value)
+ public HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, Enum indexName, Enum key, object value)
{
- return RemoveFromIndex(dbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
+ return RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName.ToString(), key.ToString(), value);
}
- public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, string indexName, string key, object value)
+ public HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, string indexName, string key, object value)
{
- HttpStatusCode status = Neo4jRestApi.RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName, key, value);
+ var status = Neo4jRestApi.RemoveRelationshipFromIndex(dbUrl, relationshipId, indexName, key, value);
if (status != HttpStatusCode.NoContent)
{
throw new Exception(string.Format("Error remove relationship from index (relationship id:{0} index name:{1} http response:{2})", relationshipId, indexName, status));
@@ -433,7 +433,7 @@ public HttpStatusCode RemoveFromIndex(string dbUrl, long relationshipId, string
#region Delete
- public HttpStatusCode Delete()
+ public HttpStatusCode DeleteRelationship()
{
HttpStatusCode status = Neo4jRestApi.DeleteRelationship(_dbUrl, Id);
if (status != HttpStatusCode.NoContent)
View
1  Neo4jRestNet/Neo4jRestNet.csproj
@@ -81,6 +81,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="CleanDbPlugin\CleanDbPlugin.cs" />
<Compile Include="Core\EncryptId.cs" />
<Compile Include="Core\Path.cs" />
<Compile Include="Core\Properties.cs" />
View
12 Neo4jRestNet/Rest/Neo4jRestApi.cs
@@ -193,10 +193,9 @@ public static HttpStatusCode AddRelationshipToIndex(string dbUrl, long relations
public static HttpStatusCode AddRelationshipToIndex(string dbUrl, string relationshipself, string indexName, string key, object value, out string response)
{
- return
- HttpRest.Post(
- string.Concat(dbUrl, "/index/relationship/", indexName, "/", key, "/",
- JToken.FromObject(value).ToString(Formatting.None)), relationshipself, out response);
+ var obj = new { value, uri = relationshipself, key };
+ return HttpRest.Post(string.Concat(dbUrl, "/index/relationship/", indexName),
+ JToken.FromObject(obj).ToString(Formatting.None), out response);
}
public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, string indexName, string key, object value)
@@ -245,10 +244,7 @@ public static HttpStatusCode GetNode(string dbUrl, string indexName, string sear
public static HttpStatusCode GetRelationship(string dbUrl, string indexName, string key, object value, out string response)
{
- return
- HttpRest.Get(
- string.Concat(dbUrl, "/index/relationship/", indexName, "/", key, "/",
- JToken.FromObject(value).ToString(Formatting.None)), out response);
+ return HttpRest.Get(string.Concat(dbUrl, "/index/relationship/", indexName, "/", key, "/", value.ToString()), out response);
}
public static HttpStatusCode GetRelationship(string dbUrl, string indexName, string searchQuery, out string response)
Please sign in to comment.
Something went wrong with that request. Please try again.