protected SqlCommand DeleteRelationshipCommand() { SqlCommand deleteNodeCommand = new SqlCommand(); deleteNodeCommand.CommandText = "DELETE FROM dbo.[Relationships] WHERE [RelationshipUid] = @RelationshipUid AND [DomainUid] = @DomainUid"; deleteNodeCommand.Connection = Connection; deleteNodeCommand.Parameters.AddWithValue("@DomainUid", DomainId.GetValue()); deleteNodeCommand.Parameters.AddWithValue("@RelationshipUid", RelationshipId.GetValue()); return(deleteNodeCommand); }
protected SqlCommand CreateNodeCommand(out Guid newNodeId) { SqlCommand createNodeCommand = new SqlCommand(); createNodeCommand.CommandText = "INSERT INTO dbo.[Domains] ([NodeUid], [NodeOriginalId], [NodeTypeUid], [DomainUid]) VALUES (@NodeUid, @NodeOriginalId, @NodeTypeUid, @DomainUid)"; createNodeCommand.Connection = Connection; newNodeId = Guid.NewGuid(); createNodeCommand.Parameters.AddWithValue("@NodeUid", newNodeId); createNodeCommand.Parameters.AddWithValue("@NodeOriginalId", OriginalId); createNodeCommand.Parameters.AddWithValue("@NodeTypeUid", NodeType.Id); createNodeCommand.Parameters.AddWithValue("@DomainUid", DomainId.GetValue()); return(createNodeCommand); }
protected SqlCommand CreateRelationship(out Guid newRelationshipUid) { SqlCommand createRelationshipCommand = new SqlCommand(); createRelationshipCommand.CommandText = "INSERT INTO dbo.[Relationships] (RelationshipUid, RelationshipOriginalId, RelationshipTypeUid, DomainUid) VALUES (@RelationshipUid, @RelationshipOriginalId, @RelationshipTypeUid, @DomainUid)"; createRelationshipCommand.Connection = Connection; newRelationshipUid = Guid.NewGuid(); createRelationshipCommand.Parameters.AddWithValue("@RelationshipUid", newRelationshipUid); createRelationshipCommand.Parameters.AddWithValue("@RelationshipOriginalId", OriginalId); createRelationshipCommand.Parameters.AddWithValue("@RelationshipTypeUid", RelationshipType.Id); createRelationshipCommand.Parameters.AddWithValue("@DomainUid", DomainId.GetValue()); return(createRelationshipCommand); }
protected bool ExecuteDomainExistsQuery() { SqlCommand domainExistsQuery = new SqlCommand(); domainExistsQuery.CommandText = "SELECT COUNT(*) FROM dbo.[Domains] WHERE dbo.[Domains].[DomainUid] = @DomainUid"; domainExistsQuery.Connection = Connection; domainExistsQuery.Parameters.AddWithValue("@DomainUid", DomainId.GetValue()); object numberOfRows = domainExistsQuery.ExecuteScalar(); if (numberOfRows != DBNull.Value) { if (((int)numberOfRows) > 0) { return(true); } } return(false); }