通过插件添加聚合连接器的源角色和目标角色

Adding the source role and destination role for aggregation connector through addin

我们通过加载项创建了聚合连接器,其中源和目标的类型为 class,如果我们尝试将源角色和目标角色设置为属性,则其具有 it.Now 中的属性,但其无法在 EA.So 中更新它 API 我们可以使用它来设置源角色和目标角色。

请参考下图:

要通过 API 设置连接器角色,请使用 Connector.ConnectorEnd class 并更新其 Role 属性。

EA.Connector c = Session.Repository.GetConnectorByGuid("<theGUID>");
EA.ConnectorEnd client = c.ClientEnd;
Client.Role = "<theNameOfTheRole>";
client.Update();

据此更新供应商端

 EA.Connector c = Session.Repository.GetConnectorByGuid("<theGUID>");
 EA.ConnectorEnd supplier = c.SupplierEnd;
 supplier.Role = "<theOtherRole>";
 supplier.Update();

在这两种情况下,您都必须提供正确的 GUID 或通过其他适当的方式获取连接器。角色本身只是一个字符串值,与任何 class 属性无关。然而,EA GUI 在角色名称下拉列表中提供了现有的属性名称。

详情请参考Sparx' Help中的ConnectorEndclass。