Inheritance: IPersistableSessionObject, IMapTransaction
        public MapParameter DeleteBulkMetadata(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter metadata)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(metadata);

            MapTransactionWrapper deleteMetadataOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction       deleteMetadataOpCore    = (IMapTransaction)deleteMetadataOpWrapper;

            deleteMetadataOpCore.OperationId          = TransactionType.DeleteMetadata;
            deleteMetadataOpWrapper.DomainParameter   = domainId;
            deleteMetadataOpWrapper.MetadataParameter = metadata;

            session.Enqueue(deleteMetadataOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = deleteMetadataOpWrapper.ResponseParameter;
            }
            else
            {
                response = deleteMetadataOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapParameter UpdateBulkNode(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter nodeId, NodeType nodeType)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(nodeId);

            MapTransactionWrapper updateNodeOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction       updateNodeOpCore    = (IMapTransaction)updateNodeOpWrapper;

            updateNodeOpCore.OperationId        = TransactionType.UpdateNode;
            updateNodeOpWrapper.DomainParameter = domainId;
            updateNodeOpWrapper.NodeParameter   = nodeId;
            updateNodeOpCore.NodeTypeUid        = nodeType.Id;

            session.Enqueue(updateNodeOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = updateNodeOpWrapper.ResponseParameter;
            }
            else
            {
                response = updateNodeOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapParameter AddBulkNode(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter rootMapId, NodeType nodeType, string originalId)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(rootMapId);

            MapTransactionWrapper createNodeOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction       createNodeOpCore    = (IMapTransaction)createNodeOpWrapper;

            createNodeOpCore.OperationId         = TransactionType.CreateNode;
            createNodeOpWrapper.DomainParameter  = domainId;
            createNodeOpWrapper.RootMapParameter = rootMapId;
            createNodeOpCore.NodeTypeUid         = nodeType.Id;

            session.Enqueue(createNodeOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = createNodeOpWrapper.ResponseParameter;
            }
            else
            {
                response = createNodeOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapParameter UpdateBulkMetadata(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter metadata, string name, string value)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(metadata);

            MapTransactionWrapper updateMetadataOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction       updateMetadataOpCore    = (IMapTransaction)updateMetadataOpWrapper;

            updateMetadataOpCore.OperationId          = TransactionType.UpdateMetadata;
            updateMetadataOpWrapper.DomainParameter   = domainId;
            updateMetadataOpWrapper.MetadataParameter = metadata;
            updateMetadataOpCore.MetadataName         = name;
            updateMetadataOpCore.MetadataValue        = value;

            session.Enqueue(updateMetadataOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = updateMetadataOpWrapper.ResponseParameter;
            }
            else
            {
                response = updateMetadataOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapParameter AddBulkMetadata(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter rootMapId, MapParameter node, MapParameter relationship, DescriptorType descriptorType, MetadataType metadataType, string name, string value)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(rootMapId);
            parameters.AddParameter(node);
            parameters.AddParameter(relationship);

            MapTransactionWrapper createMetadataOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction       createMetadataOpCore    = (IMapTransaction)createMetadataOpWrapper;

            createMetadataOpCore.OperationId              = TransactionType.CreateMetadata;
            createMetadataOpWrapper.DomainParameter       = domainId;
            createMetadataOpWrapper.RootMapParameter      = rootMapId;
            createMetadataOpWrapper.NodeParameter         = node;
            createMetadataOpWrapper.RelationshipParameter = relationship;

            if (descriptorType == null)
            {
                createMetadataOpCore.DescriptorTypeUid = null;
            }
            else
            {
                createMetadataOpCore.DescriptorTypeUid = descriptorType.Id;
            }

            if (metadataType == null)
            {
                createMetadataOpCore.MetadataTypeUid = null;
            }
            else
            {
                createMetadataOpCore.MetadataTypeUid = metadataType.Id;
            }

            createMetadataOpCore.MetadataName  = name;
            createMetadataOpCore.MetadataValue = value;

            session.Enqueue(createMetadataOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = createMetadataOpWrapper.ResponseParameter;
            }
            else
            {
                response = createMetadataOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapParameter UpdateBulkRelationship(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter relationshipId, Dictionary <DescriptorType, MapParameter> nodes, RelationshipType relationshipType)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(relationshipId);

            MapParameter response = null;

            if (relationshipType != null)
            {
                MapTransactionWrapper updateRelationshipOpWrapper = new MapTransactionWrapper(glymaSession);
                IMapTransaction       updateRelationshipOpCore    = (IMapTransaction)updateRelationshipOpWrapper;
                updateRelationshipOpCore.OperationId              = TransactionType.UpdateRelationship;
                updateRelationshipOpWrapper.DomainParameter       = domainId;
                updateRelationshipOpWrapper.RelationshipParameter = relationshipId;
                updateRelationshipOpCore.RelationshipTypeUid      = relationshipType.Id;

                session.Enqueue(updateRelationshipOpWrapper);

                if (responseParameter == Guid.Empty)
                {
                    response = updateRelationshipOpWrapper.ResponseParameter;
                }
                else
                {
                    response = updateRelationshipOpWrapper.BuildResponseParameterFromGuid(responseParameter);
                }
            }

            if (nodes != null)
            {
                foreach (KeyValuePair <DescriptorType, MapParameter> descriptorToUpdate in nodes)
                {
                    parameters.AddParameter(descriptorToUpdate.Value);

                    MapTransactionWrapper updateDescriptorOpWrapper = new MapTransactionWrapper(glymaSession);
                    IMapTransaction       updateDescriptorOpCore    = (IMapTransaction)updateDescriptorOpWrapper;
                    updateDescriptorOpCore.OperationId              = TransactionType.UpdateDescriptor;
                    updateDescriptorOpWrapper.DomainParameter       = domainId;
                    updateDescriptorOpWrapper.RelationshipParameter = relationshipId;
                    updateDescriptorOpWrapper.NodeParameter         = descriptorToUpdate.Value;
                    updateDescriptorOpCore.DescriptorTypeUid        = descriptorToUpdate.Key.Id;

                    session.Enqueue(updateDescriptorOpWrapper);
                }
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapParameter AddBulkRelationship(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter rootMapId, Dictionary <DescriptorType, MapParameter> nodes, RelationshipType relationshipType, string originalId)
        {
            MapSession    session    = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(rootMapId);

            MapTransactionWrapper createRelationshipOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction       createRelationshipOpCore    = (IMapTransaction)createRelationshipOpWrapper;

            createRelationshipOpCore.OperationId         = TransactionType.CreateRelationship;
            createRelationshipOpWrapper.DomainParameter  = domainId;
            createRelationshipOpWrapper.RootMapParameter = rootMapId;
            createRelationshipOpCore.RelationshipTypeUid = relationshipType.Id;

            session.Enqueue(createRelationshipOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = createRelationshipOpWrapper.ResponseParameter;
            }
            else
            {
                response = createRelationshipOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            if (nodes != null)
            {
                /// The nodes collection could be null if this is a relationship that is being created without the descriptors having yet been declaread.
                foreach (KeyValuePair <DescriptorType, MapParameter> descriptorToCreate in nodes)
                {
                    parameters.AddParameter(descriptorToCreate.Value);

                    MapTransactionWrapper createDescriptorOpWrapper = new MapTransactionWrapper(glymaSession);
                    IMapTransaction       createDescriptorOpCore    = (IMapTransaction)createDescriptorOpWrapper;
                    createDescriptorOpCore.OperationId              = TransactionType.CreateDescriptor;
                    createDescriptorOpWrapper.DomainParameter       = domainId;
                    createDescriptorOpWrapper.RootMapParameter      = rootMapId;
                    createDescriptorOpCore.DescriptorTypeUid        = descriptorToCreate.Key.Id;
                    createDescriptorOpWrapper.NodeParameter         = descriptorToCreate.Value;
                    createDescriptorOpWrapper.RelationshipParameter = createRelationshipOpWrapper.ResponseParameter;

                    session.Enqueue(createDescriptorOpWrapper);
                }
            }

            glymaSession.PersistSessionObject();

            return(response);
        }
        public MapResponse CompleteTransaction(IGlymaSession glymaSession, Guid sessionId)
        {
            MapSession session = glymaSession.Session;

            MapResponse response = new MapResponse();

            using (IDbConnectionAbstraction parametersDbConnection = glymaSession.ConnectionFactory.CreateParametersDbConnection())
            {
                while (session.Count > 0)
                {
                    MapTransactionWrapper transaction = session.Dequeue();

                    transaction.ExecuteOperation(ref response);

                    transaction.ResponseParameter.PersistSessionObject(parametersDbConnection);
                }

                SessionFinalisation sessionFinalisation = new SessionFinalisation(glymaSession, sessionId);
                sessionFinalisation.ExecuteCompleteSession();

                return(response);
            }
        }
        public MapParameter UpdateBulkMetadata(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter metadata, string name, string value)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(metadata);

            MapTransactionWrapper updateMetadataOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction updateMetadataOpCore = (IMapTransaction)updateMetadataOpWrapper;
            updateMetadataOpCore.OperationId = TransactionType.UpdateMetadata;
            updateMetadataOpWrapper.DomainParameter = domainId;
            updateMetadataOpWrapper.MetadataParameter = metadata;
            updateMetadataOpCore.MetadataName = name;
            updateMetadataOpCore.MetadataValue = value;

            session.Enqueue(updateMetadataOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = updateMetadataOpWrapper.ResponseParameter;
            }
            else
            {
                response = updateMetadataOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return response;
        }
        public MapParameter UpdateBulkRelationship(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter relationshipId, Dictionary<DescriptorType, MapParameter> nodes, RelationshipType relationshipType)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(relationshipId);

            MapParameter response = null;

            if (relationshipType != null)
            {
                MapTransactionWrapper updateRelationshipOpWrapper = new MapTransactionWrapper(glymaSession);
                IMapTransaction updateRelationshipOpCore = (IMapTransaction)updateRelationshipOpWrapper;
                updateRelationshipOpCore.OperationId = TransactionType.UpdateRelationship;
                updateRelationshipOpWrapper.DomainParameter = domainId;
                updateRelationshipOpWrapper.RelationshipParameter = relationshipId;
                updateRelationshipOpCore.RelationshipTypeUid = relationshipType.Id;

                session.Enqueue(updateRelationshipOpWrapper);

                if (responseParameter == Guid.Empty)
                {
                    response = updateRelationshipOpWrapper.ResponseParameter;
                }
                else
                {
                    response = updateRelationshipOpWrapper.BuildResponseParameterFromGuid(responseParameter);
                }
            }

            if (nodes != null)
            {
                foreach (KeyValuePair<DescriptorType, MapParameter> descriptorToUpdate in nodes)
                {
                    parameters.AddParameter(descriptorToUpdate.Value);

                    MapTransactionWrapper updateDescriptorOpWrapper = new MapTransactionWrapper(glymaSession);
                    IMapTransaction updateDescriptorOpCore = (IMapTransaction)updateDescriptorOpWrapper;
                    updateDescriptorOpCore.OperationId = TransactionType.UpdateDescriptor;
                    updateDescriptorOpWrapper.DomainParameter = domainId;
                    updateDescriptorOpWrapper.RelationshipParameter = relationshipId;
                    updateDescriptorOpWrapper.NodeParameter = descriptorToUpdate.Value;
                    updateDescriptorOpCore.DescriptorTypeUid = descriptorToUpdate.Key.Id;

                    session.Enqueue(updateDescriptorOpWrapper);
                }
            }

            glymaSession.PersistSessionObject();

            return response;
        }
        public MapParameter UpdateBulkNode(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter nodeId, NodeType nodeType)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(nodeId);

            MapTransactionWrapper updateNodeOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction updateNodeOpCore = (IMapTransaction)updateNodeOpWrapper;
            updateNodeOpCore.OperationId = TransactionType.UpdateNode;
            updateNodeOpWrapper.DomainParameter = domainId;
            updateNodeOpWrapper.NodeParameter = nodeId;
            updateNodeOpCore.NodeTypeUid = nodeType.Id;

            session.Enqueue(updateNodeOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = updateNodeOpWrapper.ResponseParameter;
            }
            else
            {
                response = updateNodeOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return response;
        }
        public MapParameter DeleteBulkMetadata(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter metadata)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(metadata);

            MapTransactionWrapper deleteMetadataOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction deleteMetadataOpCore = (IMapTransaction)deleteMetadataOpWrapper;
            deleteMetadataOpCore.OperationId = TransactionType.DeleteMetadata;
            deleteMetadataOpWrapper.DomainParameter = domainId;
            deleteMetadataOpWrapper.MetadataParameter = metadata;

            session.Enqueue(deleteMetadataOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = deleteMetadataOpWrapper.ResponseParameter;
            }
            else
            {
                response = deleteMetadataOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return response;
        }
        public MapParameter AddBulkMetadata(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter rootMapId, MapParameter node, MapParameter relationship, DescriptorType descriptorType, MetadataType metadataType, string name, string value)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(rootMapId);
            parameters.AddParameter(node);
            parameters.AddParameter(relationship);

            MapTransactionWrapper createMetadataOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction createMetadataOpCore = (IMapTransaction)createMetadataOpWrapper;
            createMetadataOpCore.OperationId = TransactionType.CreateMetadata;
            createMetadataOpWrapper.DomainParameter = domainId;
            createMetadataOpWrapper.RootMapParameter = rootMapId;
            createMetadataOpWrapper.NodeParameter = node;
            createMetadataOpWrapper.RelationshipParameter = relationship;

            if (descriptorType == null)
            {
                createMetadataOpCore.DescriptorTypeUid = null;
            }
            else
            {
                createMetadataOpCore.DescriptorTypeUid = descriptorType.Id;
            }

            if (metadataType == null)
            {
                createMetadataOpCore.MetadataTypeUid = null;
            }
            else
            {
                createMetadataOpCore.MetadataTypeUid = metadataType.Id;
            }

            createMetadataOpCore.MetadataName = name;
            createMetadataOpCore.MetadataValue = value;

            session.Enqueue(createMetadataOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = createMetadataOpWrapper.ResponseParameter;
            }
            else
            {
                response = createMetadataOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return response;
        }
        public MapParameter AddBulkRelationship(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter rootMapId, Dictionary<DescriptorType, MapParameter> nodes, RelationshipType relationshipType, string originalId)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;

            parameters.AddParameter(domainId);
            parameters.AddParameter(rootMapId);

            MapTransactionWrapper createRelationshipOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction createRelationshipOpCore = (IMapTransaction)createRelationshipOpWrapper;
            createRelationshipOpCore.OperationId = TransactionType.CreateRelationship;
            createRelationshipOpWrapper.DomainParameter = domainId;
            createRelationshipOpWrapper.RootMapParameter = rootMapId;
            createRelationshipOpCore.RelationshipTypeUid = relationshipType.Id;

            session.Enqueue(createRelationshipOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = createRelationshipOpWrapper.ResponseParameter;
            }
            else
            {
                response = createRelationshipOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            if (nodes != null)
            {
                /// The nodes collection could be null if this is a relationship that is being created without the descriptors having yet been declaread.
                foreach (KeyValuePair<DescriptorType, MapParameter> descriptorToCreate in nodes)
                {
                    parameters.AddParameter(descriptorToCreate.Value);

                    MapTransactionWrapper createDescriptorOpWrapper = new MapTransactionWrapper(glymaSession);
                    IMapTransaction createDescriptorOpCore = (IMapTransaction)createDescriptorOpWrapper;
                    createDescriptorOpCore.OperationId = TransactionType.CreateDescriptor;
                    createDescriptorOpWrapper.DomainParameter = domainId;
                    createDescriptorOpWrapper.RootMapParameter = rootMapId;
                    createDescriptorOpCore.DescriptorTypeUid = descriptorToCreate.Key.Id;
                    createDescriptorOpWrapper.NodeParameter = descriptorToCreate.Value;
                    createDescriptorOpWrapper.RelationshipParameter = createRelationshipOpWrapper.ResponseParameter;

                    session.Enqueue(createDescriptorOpWrapper);
                }
            }

            glymaSession.PersistSessionObject();

            return response;
        }
        public MapParameter AddBulkNode(IGlymaSession glymaSession, Guid sessionId, Guid responseParameter, MapParameter domainId, MapParameter rootMapId, NodeType nodeType, string originalId)
        {
            MapSession session = glymaSession.Session;
            MapParameters parameters = glymaSession.Parameters;
            parameters.AddParameter(domainId);
            parameters.AddParameter(rootMapId);

            MapTransactionWrapper createNodeOpWrapper = new MapTransactionWrapper(glymaSession);
            IMapTransaction createNodeOpCore = (IMapTransaction)createNodeOpWrapper;
            createNodeOpCore.OperationId = TransactionType.CreateNode;
            createNodeOpWrapper.DomainParameter = domainId;
            createNodeOpWrapper.RootMapParameter = rootMapId;
            createNodeOpCore.NodeTypeUid = nodeType.Id;

            session.Enqueue(createNodeOpWrapper);

            MapParameter response;

            if (responseParameter == Guid.Empty)
            {
                response = createNodeOpWrapper.ResponseParameter;
            }
            else
            {
                response = createNodeOpWrapper.BuildResponseParameterFromGuid(responseParameter);
            }

            glymaSession.PersistSessionObject();

            return response;
        }