// Umbraco.Code.MapAll -Alias private static void Map(IEntitySlim source, EntityBasic target, MapperContext context) { target.Icon = MapContentTypeIcon(source); target.Id = source.Id; target.Key = source.Key; target.Name = MapName(source, context); target.ParentId = source.ParentId; target.Path = source.Path; target.Trashed = source.Trashed; target.Udi = Udi.Create(ObjectTypes.GetUdiType(source.NodeObjectType), source.Key); if (source.NodeObjectType == Constants.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace()) { target.Icon = "icon-user"; } // NOTE: we're mapping the objects in AdditionalData by object reference here. // it works fine for now, but it's something to keep in mind in the future foreach (var kvp in source.AdditionalData) { target.AdditionalData[kvp.Key] = kvp.Value; } target.AdditionalData.Add("IsContainer", source.IsContainer); }
// Umbraco.Code.MapAll -Alias private static void Map(IEntitySlim source, EntityBasic target, MapperContext context) { target.Icon = MapContentTypeIcon(source); target.Id = source.Id; target.Key = source.Key; target.Name = MapName(source, context); target.ParentId = source.ParentId; target.Path = source.Path; target.Trashed = source.Trashed; target.Udi = Udi.Create(ObjectTypes.GetUdiType(source.NodeObjectType), source.Key); if (source is IContentEntitySlim contentSlim) { source.AdditionalData["ContentTypeAlias"] = contentSlim.ContentTypeAlias; } if (source is IDocumentEntitySlim documentSlim) { source.AdditionalData["IsPublished"] = documentSlim.Published; } if (source is IMediaEntitySlim mediaSlim) { source.AdditionalData["MediaPath"] = mediaSlim.MediaPath; } // NOTE: we're mapping the objects in AdditionalData by object reference here. // it works fine for now, but it's something to keep in mind in the future foreach (var kvp in source.AdditionalData) { target.AdditionalData[kvp.Key] = kvp.Value; } target.AdditionalData.Add("IsContainer", source.IsContainer); }
// Umbraco.Code.MapAll -ParentId -Path -Trashed -Udi -Icon private static void Map(IDictionaryItem source, EntityBasic target, MapperContext context) { target.Alias = source.ItemKey; target.Id = source.Id; target.Key = source.Key; target.Name = source.ItemKey; }
// Umbraco.Code.MapAll -Udi -Path -Trashed -AdditionalData -Icon private static void Map(ILanguage source, EntityBasic target, MapperContext context) { target.Name = source.CultureName; target.Key = source.Key; target.ParentId = -1; target.Alias = source.IsoCode; target.Id = source.Id; }
public MediaItemDisplay PostAddFolder(EntityBasic folder) { var mediaService = ApplicationContext.Services.MediaService; var f = mediaService.CreateMedia(folder.Name, folder.ParentId, Constants.Conventions.MediaTypes.Folder); mediaService.Save(f, Security.CurrentUser.Id); return(Mapper.Map <IMedia, MediaItemDisplay>(f)); }
// Umbraco.Code.MapAll -Trashed -Udi -Icon private static void Map(IPartialView source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = -1; target.Path = source.Path; }
// Umbraco.Code.MapAll -Udi -Trashed private static void Map(IUser source, EntityBasic target, MapperContext context) { target.Alias = source.Username; target.Icon = "icon-user"; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = -1; target.Path = ""; }
// Umbraco.Code.MapAll -Udi -Trashed private static void Map(PropertyGroup source, EntityBasic target, MapperContext context) { target.Alias = source.Name.ToLowerInvariant(); target.Icon = "icon-tab"; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = -1; target.Path = ""; }
// Umbraco.Code.MapAll -Udi -Trashed private static void Map(PropertyType source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; target.Icon = "icon-box"; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = -1; target.Path = ""; }
// Umbraco.Code.MapAll -Trashed -AdditionalData private static void Map(IMacro source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; target.Icon = Constants.Icons.Macro; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = -1; target.Path = "-1," + source.Id; target.Udi = Udi.Create(Constants.UdiEntityType.Macro, source.Key); }
// Umbraco.Code.MapAll -Trashed private static void Map(ITemplate source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; target.Icon = "icon-layout"; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = -1; target.Path = source.Path; target.Udi = Udi.Create(Constants.UdiEntityType.Template, source.Key); }
// Umbraco.Code.MapAll -Trashed private static void Map(IContentTypeComposition source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; target.Icon = source.Icon; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; target.ParentId = source.ParentId; target.Path = source.Path; target.Udi = ContentTypeMapDefinition.MapContentTypeUdi(source); }
// Umbraco.Code.MapAll -Alias private static void Map(IEntitySlim source, EntityBasic target, MapperContext context) { target.Icon = MapContentTypeIcon(source); target.Id = source.Id; target.Key = source.Key; target.Name = MapName(source, context); target.ParentId = source.ParentId; target.Path = source.Path; target.Trashed = source.Trashed; target.Udi = Udi.Create(ObjectTypes.GetUdiType(source.NodeObjectType), source.Key); if (source is IContentEntitySlim contentSlim) { source.AdditionalData !["ContentTypeAlias"] = contentSlim.ContentTypeAlias;
public static EntityBasic Map(ISearchContent item) { var e = new EntityBasic(); e.Name = item.Name; e.Id = item.Id; e.ParentId = item.ParentId; e.Key = new System.Guid(item.Key); e.Icon = item.GetPropertyValue <string>("Icon"); e.Trashed = item.GetPropertyValue <bool>("Trashed"); e.Alias = null; var path = item.Path; if (path != null) { e.Path = string.Join(",", path); } return(e); }
// Umbraco.Code.MapAll -SortOrder private static void Map(EntityBasic source, ContentTypeSort target, MapperContext context) { target.Alias = source.Alias; target.Id = new Lazy <int>(() => Convert.ToInt32(source.Id)); }