2021-07-08 13:11:39 -06:00
|
|
|
using Umbraco.Cms.Core.Mapping;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Models.ContentEditing;
|
2017-05-12 14:49:44 +02:00
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
namespace Umbraco.Cms.Core.Models.Mapping
|
2017-05-12 14:49:44 +02:00
|
|
|
{
|
2019-04-03 10:39:49 +02:00
|
|
|
public class CodeFileMapDefinition : IMapDefinition
|
2017-05-12 14:49:44 +02:00
|
|
|
{
|
2021-04-20 19:34:18 +02:00
|
|
|
public void DefineMaps(IUmbracoMapper mapper)
|
2017-05-12 14:49:44 +02:00
|
|
|
{
|
2019-11-12 13:49:56 +11:00
|
|
|
mapper.Define<IStylesheet, EntityBasic>((source, context) => new EntityBasic(), Map);
|
2021-07-08 13:11:39 -06:00
|
|
|
mapper.Define<IStylesheet, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
|
|
|
|
|
|
|
|
|
mapper.Define<IPartialView, EntityBasic>((source, context) => new EntityBasic(), Map);
|
2019-03-26 13:58:38 +01:00
|
|
|
mapper.Define<IPartialView, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
2021-07-08 13:11:39 -06:00
|
|
|
|
|
|
|
|
mapper.Define<IScript, EntityBasic>((source, context) => new EntityBasic(), Map);
|
2019-11-12 13:49:56 +11:00
|
|
|
mapper.Define<IScript, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
2021-07-08 13:11:39 -06:00
|
|
|
|
2019-03-25 09:03:46 +01:00
|
|
|
mapper.Define<CodeFileDisplay, IPartialView>(Map);
|
2019-11-12 13:49:56 +11:00
|
|
|
mapper.Define<CodeFileDisplay, IScript>(Map);
|
2019-01-17 00:29:43 +11:00
|
|
|
|
2019-03-24 12:01:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Umbraco.Code.MapAll -Trashed -Udi -Icon
|
2019-11-12 13:49:56 +11:00
|
|
|
private static void Map(IStylesheet source, EntityBasic target, MapperContext context)
|
2019-03-24 12:01:23 +01:00
|
|
|
{
|
|
|
|
|
target.Alias = source.Alias;
|
|
|
|
|
target.Id = source.Id;
|
2021-07-08 13:11:39 -06:00
|
|
|
target.Key = source.Key;
|
|
|
|
|
target.Name = source.Name;
|
|
|
|
|
target.ParentId = -1;
|
|
|
|
|
target.Path = source.Path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Umbraco.Code.MapAll -Trashed -Udi -Icon
|
|
|
|
|
private static void Map(IScript 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 -Trashed -Udi -Icon
|
|
|
|
|
private static void Map(IPartialView source, EntityBasic target, MapperContext context)
|
|
|
|
|
{
|
|
|
|
|
target.Alias = source.Alias;
|
|
|
|
|
target.Id = source.Id;
|
2019-03-24 12:01:23 +01:00
|
|
|
target.Key = source.Key;
|
|
|
|
|
target.Name = source.Name;
|
|
|
|
|
target.ParentId = -1;
|
|
|
|
|
target.Path = source.Path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
|
2019-03-26 13:58:38 +01:00
|
|
|
private static void Map(IPartialView source, CodeFileDisplay target, MapperContext context)
|
2019-03-24 12:01:23 +01:00
|
|
|
{
|
|
|
|
|
target.Content = source.Content;
|
|
|
|
|
target.Id = source.Id.ToString();
|
|
|
|
|
target.Name = source.Name;
|
|
|
|
|
target.VirtualPath = source.VirtualPath;
|
|
|
|
|
}
|
2017-05-12 14:49:44 +02:00
|
|
|
|
2019-03-24 12:01:23 +01:00
|
|
|
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
|
2019-11-12 13:49:56 +11:00
|
|
|
private static void Map(IScript source, CodeFileDisplay target, MapperContext context)
|
2019-03-24 12:01:23 +01:00
|
|
|
{
|
|
|
|
|
target.Content = source.Content;
|
|
|
|
|
target.Id = source.Id.ToString();
|
|
|
|
|
target.Name = source.Name;
|
|
|
|
|
target.VirtualPath = source.VirtualPath;
|
|
|
|
|
}
|
2017-05-12 14:49:44 +02:00
|
|
|
|
2019-03-24 12:01:23 +01:00
|
|
|
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
|
2019-11-12 13:49:56 +11:00
|
|
|
private static void Map(IStylesheet source, CodeFileDisplay target, MapperContext context)
|
2019-03-24 12:01:23 +01:00
|
|
|
{
|
|
|
|
|
target.Content = source.Content;
|
|
|
|
|
target.Id = source.Id.ToString();
|
|
|
|
|
target.Name = source.Name;
|
|
|
|
|
target.VirtualPath = source.VirtualPath;
|
|
|
|
|
}
|
2018-10-27 21:18:03 +02:00
|
|
|
|
2019-03-24 12:01:23 +01:00
|
|
|
// Umbraco.Code.MapAll -CreateDate -DeleteDate -UpdateDate
|
|
|
|
|
// Umbraco.Code.MapAll -Id -Key -Alias -Name -OriginalPath -Path
|
2019-03-26 13:58:38 +01:00
|
|
|
private static void Map(CodeFileDisplay source, IPartialView target, MapperContext context)
|
2019-03-24 12:01:23 +01:00
|
|
|
{
|
|
|
|
|
target.Content = source.Content;
|
|
|
|
|
target.VirtualPath = source.VirtualPath;
|
|
|
|
|
}
|
2017-05-12 14:49:44 +02:00
|
|
|
|
2019-03-24 12:01:23 +01:00
|
|
|
// Umbraco.Code.MapAll -CreateDate -DeleteDate -UpdateDate -GetFileContent
|
|
|
|
|
// Umbraco.Code.MapAll -Id -Key -Alias -Name -OriginalPath -Path
|
2019-11-12 13:49:56 +11:00
|
|
|
private static void Map(CodeFileDisplay source, IScript target, MapperContext context)
|
2019-03-24 12:01:23 +01:00
|
|
|
{
|
|
|
|
|
target.Content = source.Content;
|
|
|
|
|
target.VirtualPath = source.VirtualPath;
|
2017-05-12 14:49:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|