mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:23:26 +08:00
添加项目文件。
This commit is contained in:
46
CoreCms.Net.Mapping/AutoMapperConfiguration.cs
Normal file
46
CoreCms.Net.Mapping/AutoMapperConfiguration.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.IO;
|
||||
using AutoMapper;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CoreCms.Net.Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// AutoMapper的全局实体映射配置静态类
|
||||
/// </summary>
|
||||
public class AutoMapperConfiguration : Profile, AutoMapperIProfile
|
||||
{
|
||||
public AutoMapperConfiguration()
|
||||
{
|
||||
//CreateMap<Manager, ManagerDTO>().ReverseMap();
|
||||
|
||||
CreateMap<SqlSugar.DbTableInfo, CoreCms.Net.Model.ViewModels.Basics.DbTableInfoTree>()
|
||||
.AfterMap((from, to, context) =>
|
||||
{
|
||||
to.Label = from.Name + "[" + from.Description + "]";
|
||||
});
|
||||
|
||||
//商品分类转前端json
|
||||
CreateMap<CoreCmsGoodsCategory, DTreeList>()
|
||||
.AfterMap((from, to, context) =>
|
||||
{
|
||||
to.id = from.id.ToString();
|
||||
to.title = from.name;
|
||||
to.checkArr = "0";
|
||||
to.parentId = from.parentId.ToString();
|
||||
});
|
||||
|
||||
#region 小程序交互相关=======================================================================================
|
||||
//小程序首页获取页面布局信息数据转换
|
||||
CreateMap<CoreCmsPagesItems, PagesItemsDto>()
|
||||
.AfterMap((from, to, context) =>
|
||||
{
|
||||
to.parameters = new JsonSerializer().Deserialize(new JsonTextReader(new StringReader(from.parameters)));
|
||||
});
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
6
CoreCms.Net.Mapping/AutoMapperIProfile.cs
Normal file
6
CoreCms.Net.Mapping/AutoMapperIProfile.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace CoreCms.Net.Mapping
|
||||
{
|
||||
internal interface AutoMapperIProfile
|
||||
{
|
||||
}
|
||||
}
|
||||
16
CoreCms.Net.Mapping/CoreCms.Net.Mapping.csproj
Normal file
16
CoreCms.Net.Mapping/CoreCms.Net.Mapping.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CoreCms.Net.Model\CoreCms.Net.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user