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); } }
public TypeResponse GetAllMapTypes(IGlymaSession glymaSession) { using (IDbConnectionAbstraction mapDbConnection = glymaSession.ConnectionFactory.CreateMapDbConnection()) { MapSchema mapSchema = new MapSchema(mapDbConnection); TypeResponse response = mapSchema.LoadTypesFromDb(); return(response); } }