const entity1 = domainmodels.Entity.createIn(domainModel);
entity1.name = `NewEntity1_${Date.now()}`;
const entity2 = domainmodels.Entity.createIn(domainModel);
entity2.name = `NewEntity2_${Date.now()}`;
const association1to1 = domainmodels.Association.createIn(domainModel);
association1to1.name = entity2.name + "_" + entity1.name;
association1to1.parent = entity1;
association1to1.child = entity2;
association1to1.type = domainmodels.AssociationType.Reference
association1to1.owner = domainmodels.AssociationOwner.Both;
for one to one you can use
const association1to1 = domainmodels.Association.createIn(workingCopy.model);
association1to1.parent = entity1;
association1to1.child = entity2;
association1to1.type = domainmodels.AssociationType.Reference;
For N to N, you need to create 2 association 1-N,
const intermediateEntity = domainmodels.Entity.createIn(workingCopy.model);
// First 1-N association
const associationNtoIntermediate = domainmodels.Association.createIn(workingCopy.model);
associationNtoIntermediate.parent = entity1;
associationNtoIntermediate.child = intermediateEntity;
associationNtoIntermediate.type = domainmodels.AssociationType.ReferenceSet;
// Second 1-N association
const associationIntermediateToN = domainmodels.Association.createIn(workingCopy.model);
associationIntermediateToN.parent = intermediateEntity;
associationIntermediateToN.child = entity2;
associationIntermediateToN.type = domainmodels.AssociationType.ReferenceSet;