emett
emett

Reputation: 31

1:n Derived Settable Association

There is an example of n:1 derived settable association in MDriven Wiki: https://wiki.mdriven.net/index.php/Derived_settable_associations

I'm trying to implement for a multi link Collection(Person) - Person is the target class name. The context in DerivationOCLSet is Person. As far as I understand I access the other end instance over vInputParameter. So, I define it as so (simplifyed):

self.Mother := vInputParameter.Mother (Mother ist an 0..1-association end of Person, also Person).

The model Validation gives me error: "Association End DeriveSet: Person.Sisters: You can never use := to assign a collection - consider using ->first or ->last to get single value"

Another issue I have: If I let DerivationOCLSet empty and let C# generation no method is generated. It it as designed? What Name/Signature is expected then?

/Efim

Upvotes: 0

Views: 35

Answers (2)

Lars
Lars

Reputation: 201

Efim, can you provide more information? I don't fully understand what you are trying to do.

Removing is done with... no, I don't know how to answer without model section and metod signature

Upvotes: 0

Hans Karlsen
Hans Karlsen

Reputation: 2435

As the message says you cannot assign collections - but you can add - so go like vinputparam->foreach(x| self.sisters.add(x))

Upvotes: 0

Related Questions