Click or drag to resize
How Do I Define Custom Relationship
Zet Universe

[This is preliminary documentation and is subject to change.]

You use custom Kinds, Relationships, and Properties to create your own types or extend existing types in Zet Universe. This section describes how to create a custom Relationship.

Define and Register Your Custom Relationship

  1. Declare new AppRelationshipDefinition

  2. Set it's AppId to your plugin's Id

  3. Define Description From

  4. Define Description

  5. Define the Relation Namespace Name for your new Relationship

  6. Add pairs of participating Kinds

  7. Register your Relationship using IAppManager.RegisterRelationship() API.

Example
using ZU.Core.Apps;

private void RegisterRelationships()
{
    // 1. Declare new AppRelationshipDefinition
    AppRelationshipDefinition organized = new AppRelationshipDefinition();

    // 2. Set it's AppId to your plugin's Id
    organized.AppId = this.Id.ToString();

    // 3. Define Description From
    organized.DescriptionFrom = "organized";

    // 4. Define Description
    organized.Description = "organized by";

    // 5. Define the Relation Namespace Name for your new Relationship
    organized.Relation = "Organized";

    // 6. Add pairs of participating Kinds
    organized.AllowedParticipatingKinds.Add(new Tuple<string, string>("OrganizationStructureAnalyzer.Kinds.Organizations.CommercialOrganization", ZU.Constants.Kinds.Meeting));

    // 7. Register your Relationship using IAppManager.RegisterRelationship() API.
    _appManager.RegisterRelationship(organized);
}
See Also