IObjectList customers = vfs.CreateTypedObjectList(typeof(Customer));
foreach (Customer currentCustomer in someOtherList)
customers.Add(currentCustomer);
//If a customer has a single contract
IObjectList result = OclPs.Execute(customers, "self.contract");
//If a customer has many contracts
IObjectList result = OclPs.Execute(customers, "self.contracts");
//If the association is one way from contract to customer
IObjectList result = OclPs.Execute(customers,
"Contract.allInstances->select(currentContract |
currentContract.customer->includes(self))");
Might not compile though :-)
本文介绍如何使用VFS创建类型化的对象列表,并通过OCL执行查询来筛选客户及其合同。提供了不同场景下的OCL表达式实例,包括单个合同、多个合同以及合同到客户的单向关联。
1394

被折叠的 条评论
为什么被折叠?



