Inheritance: IPersistableSessionObject
        public MapResponse CreateDomain(IGlymaSession glymaSession, string name)
        {
            using (IDbConnectionAbstraction mapDbConnection = glymaSession.ConnectionFactory.CreateMapDbConnection())
            {
                Domain newDomain = new Domain(true);
                newDomain.DomainUid = Guid.NewGuid();
                newDomain.DomainOriginalId = null;

                TypeResponse types = GetAllMapTypes(glymaSession);

                NodeType domainNodeType = types.NodeTypes["DomainNode"];
                MetadataType stringMetadataType = types.MetadataTypes["string"];

                newDomain.PersistSessionObject(mapDbConnection);

                Guid sessionId = BeginTransaction(glymaSession);

                MapParameter domainIdParameter = new MapParameter();
                domainIdParameter.Id = Guid.NewGuid();
                domainIdParameter.IsDelayed = false;
                domainIdParameter.ParameterType = MapParameterType.Domain;
                domainIdParameter.SessionId = sessionId;
                domainIdParameter.Value = newDomain.DomainUid;

                MapParameter newNode = AddNode(glymaSession, sessionId, domainIdParameter, null, domainNodeType, string.Empty);
                AddMetadata(glymaSession, sessionId, domainIdParameter, null, newNode, null, null, stringMetadataType, "Name", name);

                MapResponse newDomainNodeResponse = CompleteTransaction(glymaSession, sessionId);

                return newDomainNodeResponse;
            }
        }
示例#2
0
        public Domain DomainCreate()
        {
            Domain newDomain = new Domain();

            Guid newDomainId;
            Guid newDomainNodeId;

            SqlCommand createDomainCommand = CreateDomainCommand(out newDomainId, out newDomainNodeId);
            createDomainCommand.ExecuteNonQuery();

            newDomain.DomainUid = newDomainId;
            newDomain.DomainOriginalId = newDomainId.ToString();

            return newDomain;
        }
示例#3
0
        public Relationship RelationshipCreate(Domain newDomain, Guid relationshipTypeId, IDictionary<Guid, Guid> nodes)
        {
            Guid newRelationshipId;
            Relationship newRelationship = new Relationship();

            SqlCommand createRelationshipCommand = CreateRelationshipCommand(out newRelationshipId, newDomain.DomainUid, relationshipTypeId, nodes);

            createRelationshipCommand.ExecuteNonQuery();

            newRelationship.RelationshipUid = Guid.Empty;
            newRelationship.RelationshipOriginalId = string.Empty;
            newRelationship.RelationshipTypeUid = relationshipTypeId;
            newRelationship.DomainUid = newDomain.DomainUid;

            return newRelationship;
        }
示例#4
0
        public Node NodeCreate(Domain newDomain, Guid nodeTypeId)
        {
            Guid newNodeId;
            Node newNode = new Node();

            SqlCommand createNodeCommand = CreateNodeCommand(out newNodeId, nodeTypeUid: nodeTypeId, domainUid: newDomain.DomainUid);
            createNodeCommand.Parameters.AddWithValue("@NodeOriginalId", newNodeId.ToString());

            createNodeCommand.ExecuteNonQuery();

            newNode.NodeUid = newNodeId;
            newNode.NodeOriginalId = newNodeId.ToString();
            newNode.NodeTypeUid = nodeTypeId;
            newNode.DomainUid = newDomain.DomainUid;

            return newNode;
        }
示例#5
0
        public Node DomainGetRootNode(Domain domain)
        {
            Node domainNode = new Node();

            SqlCommand selectDomainNodeCommand = SelectDomainNodeCommand(domain.DomainUid);
            SqlDataReader reader = selectDomainNodeCommand.ExecuteReader();

            if (reader.Read())
            {
                domainNode.NodeUid = (Guid)reader["NodeUid"];
                domainNode.NodeOriginalId = (string)reader["NodeOriginalId"];
                domainNode.NodeTypeUid = (Guid)reader["NodeTypeUid"];
                domainNode.DomainUid = (Guid)reader["DomainUid"];
            }

            return domainNode;
        }