示例#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();
        }
    }
示例#2
0
        // Umbraco.Code.MapAll -Icon -Trashed -AdditionalData
        // Umbraco.Code.MapAll -Relations -ParentId -Notifications
        private static void Map(IRelationType source, RelationTypeDisplay target, MapperContext context)
        {
            target.ChildObjectType = source.ChildObjectType;
            target.Id = source.Id;
            target.IsBidirectional  = source.IsBidirectional;
            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;

            // Set the "friendly" names for the parent and child object types
            target.ParentObjectTypeName = ObjectTypes.GetUmbracoObjectType(source.ParentObjectType).GetFriendlyName();
            target.ChildObjectTypeName  = ObjectTypes.GetUmbracoObjectType(source.ChildObjectType).GetFriendlyName();
        }