Netcore: Migration of Model classes from Umbraco.Infrastructure to Core (#9404)
* Migrating more model, mapping and tree classes * Migrating files from Mapping dir without Newtonsoft dependency * Migrating files from PublishedContent and Editors dirs without Newtonsoft dependency + some more of the same kind * Migrating DataType class without the usage of Newtonsoft.Json and making the corresponding changes to all classes affected * Combining 3 ContentExtensions files into 1 * Refactoring from migrating ContentExtensions * Migrating more classes * Migrating ContentRepositoryExtensions - combining it with existing file in Umbraco.Core * removing Newtonsoft json dependency & migrating file. Adding partial migration of ConfigurationEditor, so PropertyTagsExtensions can be migrated * Migrating ContentTagsExtensions, and refactoring from changes in PropertyTagsExtensions * Changes that should be reverted once ConfigurationEditor class is fully migrated * VS couldn't find Composing, so build was failing. Removing the using solves the problem * Handling a single case for deserializing a subset of an input * Small changes and added tests to JsonNetSerializer Signed-off-by: Bjarke Berg <mail@bergmania.dk> * Migrated ConfigurationEditor Signed-off-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
committed by
GitHub
parent
d498c1a2cd
commit
dd5f400cf3
74
src/Umbraco.Core/Models/Mapping/CodeFileMapDefinition.cs
Normal file
74
src/Umbraco.Core/Models/Mapping/CodeFileMapDefinition.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
public class CodeFileMapDefinition : IMapDefinition
|
||||
{
|
||||
public void DefineMaps(UmbracoMapper mapper)
|
||||
{
|
||||
mapper.Define<IStylesheet, EntityBasic>((source, context) => new EntityBasic(), Map);
|
||||
mapper.Define<IPartialView, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
||||
mapper.Define<IScript, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
||||
mapper.Define<IStylesheet, CodeFileDisplay>((source, context) => new CodeFileDisplay(), Map);
|
||||
mapper.Define<CodeFileDisplay, IPartialView>(Map);
|
||||
mapper.Define<CodeFileDisplay, IScript>(Map);
|
||||
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll -Trashed -Udi -Icon
|
||||
private static void Map(IStylesheet 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 -FileType -Notifications -Path -Snippet
|
||||
private static void Map(IPartialView source, CodeFileDisplay target, MapperContext context)
|
||||
{
|
||||
target.Content = source.Content;
|
||||
target.Id = source.Id.ToString();
|
||||
target.Name = source.Name;
|
||||
target.VirtualPath = source.VirtualPath;
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
|
||||
private static void Map(IScript source, CodeFileDisplay target, MapperContext context)
|
||||
{
|
||||
target.Content = source.Content;
|
||||
target.Id = source.Id.ToString();
|
||||
target.Name = source.Name;
|
||||
target.VirtualPath = source.VirtualPath;
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll -FileType -Notifications -Path -Snippet
|
||||
private static void Map(IStylesheet source, CodeFileDisplay target, MapperContext context)
|
||||
{
|
||||
target.Content = source.Content;
|
||||
target.Id = source.Id.ToString();
|
||||
target.Name = source.Name;
|
||||
target.VirtualPath = source.VirtualPath;
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll -CreateDate -DeleteDate -UpdateDate
|
||||
// Umbraco.Code.MapAll -Id -Key -Alias -Name -OriginalPath -Path
|
||||
private static void Map(CodeFileDisplay source, IPartialView target, MapperContext context)
|
||||
{
|
||||
target.Content = source.Content;
|
||||
target.VirtualPath = source.VirtualPath;
|
||||
}
|
||||
|
||||
// Umbraco.Code.MapAll -CreateDate -DeleteDate -UpdateDate -GetFileContent
|
||||
// Umbraco.Code.MapAll -Id -Key -Alias -Name -OriginalPath -Path
|
||||
private static void Map(CodeFileDisplay source, IScript target, MapperContext context)
|
||||
{
|
||||
target.Content = source.Content;
|
||||
target.VirtualPath = source.VirtualPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user