Beispiel #1
0
    // Umbraco.Code.MapAll -Icon -Trashed -AdditionalData
    // Umbraco.Code.MapAll -ParentId -Notifications
    private void Map(IRelationType source, RelationTypeDisplay target, MapperContext context)
    {
        target.ChildObjectType = source.ChildObjectType;
        target.Id = source.Id;
        target.IsBidirectional = source.IsBidirectional;

        if (source is IRelationTypeWithIsDependency sourceWithIsDependency)
        {
            target.IsDependency = sourceWithIsDependency.IsDependency;
        }

        target.Key              = source.Key;
        target.Name             = source.Name;
        target.Alias            = source.Alias;
        target.ParentObjectType = source.ParentObjectType;
        target.Udi              = Udi.Create(Constants.UdiEntityType.RelationType, source.Key);
        target.Path             = "-1," + source.Id;

        target.IsSystemRelationType = source.IsSystemRelationType();

        // Set the "friendly" and entity names for the parent and child object types
        if (source.ParentObjectType.HasValue)
        {
            UmbracoObjectTypes objType = ObjectTypes.GetUmbracoObjectType(source.ParentObjectType.Value);
            target.ParentObjectTypeName = objType.GetFriendlyName();
        }

        if (source.ChildObjectType.HasValue)
        {
            UmbracoObjectTypes objType = ObjectTypes.GetUmbracoObjectType(source.ChildObjectType.Value);
            target.ChildObjectTypeName = objType.GetFriendlyName();
        }
    }