Skip to content

Commit 8bd7425

Browse files
Replacing AutoMapper with Grand.Mapping (#664)
* Remove automapper - add new implementation * Add Grand.Mapping.Tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
1 parent 2107395 commit 8bd7425

File tree

400 files changed

+8334
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

400 files changed

+8334
-139
lines changed

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.1" />
3131
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
3232
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="10.0.1" />
33-
<PackageVersion Include="AutoMapper" Version="14.0.0" />
3433
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
3534
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.0.0" />
3635
<PackageVersion Include="MediatR" Version="12.5.0" />
@@ -59,10 +58,11 @@
5958
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="10.0.1" />
6059
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
6160
<PackageVersion Include="Moq" Version="4.20.72" />
62-
<PackageVersion Include="MSTest.TestAdapter" Version="4.0.2" />
63-
<PackageVersion Include="MSTest.TestFramework" Version="4.0.2" />
61+
<PackageVersion Include="MSTest.TestAdapter" Version="4.1.0" />
62+
<PackageVersion Include="MSTest.TestFramework" Version="4.1.0" />
6463
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
6564
<PackageVersion Include="NUnit" Version="4.4.0" />
65+
<PackageVersion Include="Verify.MSTest" Version="31.13.5" />
6666
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.1.0" />
6767
<PackageVersion Include="Aspire.Hosting.MongoDB" Version="13.1.0" />
6868
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.1.0" />

GrandNode.sln

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grand.Web.Common", "src\Web
3939
EndProject
4040
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grand.Infrastructure", "src\Core\Grand.Infrastructure\Grand.Infrastructure.csproj", "{34A46D97-5996-46B3-BDCA-631EDAA0E210}"
4141
EndProject
42+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grand.Mapping", "src\Core\Grand.Mapping\Grand.Mapping.csproj", "{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}"
43+
EndProject
4244
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{F6F48227-B3C5-4A51-B33F-FF9AD96352DB}"
4345
EndProject
4446
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.Facebook", "src\Plugins\Authentication.Facebook\Authentication.Facebook.csproj", "{BA4579AF-9C20-477A-891B-926968B11C68}"
@@ -145,6 +147,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.ServiceDefaults", "s
145147
EndProject
146148
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grand.Web.AdminShared", "src\Web\Grand.Web.AdminShared\Grand.Web.AdminShared.csproj", "{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}"
147149
EndProject
150+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
151+
EndProject
152+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grand.Mapping.Tests", "src\Tests\Grand.Mapping.Tests\Grand.Mapping.Tests.csproj", "{396E6929-5365-4116-8AA8-DF5327247798}"
153+
EndProject
154+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{03997797-E7F5-0643-168D-B8EA7178C2FE}"
155+
EndProject
156+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{EC447DCF-ABFA-6E24-52A5-D7FD48A5C558}"
157+
EndProject
158+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Business", "Business", "{CC1F4FA2-92F2-BA4B-815B-7EC2CBBCCF50}"
159+
EndProject
148160
Global
149161
GlobalSection(SolutionConfigurationPlatforms) = preSolution
150162
Debug|Any CPU = Debug|Any CPU
@@ -323,6 +335,18 @@ Global
323335
{34A46D97-5996-46B3-BDCA-631EDAA0E210}.Release|x64.Build.0 = Release|Any CPU
324336
{34A46D97-5996-46B3-BDCA-631EDAA0E210}.Release|x86.ActiveCfg = Release|Any CPU
325337
{34A46D97-5996-46B3-BDCA-631EDAA0E210}.Release|x86.Build.0 = Release|Any CPU
338+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
339+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
340+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x64.ActiveCfg = Debug|Any CPU
341+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x64.Build.0 = Debug|Any CPU
342+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x86.ActiveCfg = Debug|Any CPU
343+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Debug|x86.Build.0 = Debug|Any CPU
344+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
345+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|Any CPU.Build.0 = Release|Any CPU
346+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x64.ActiveCfg = Release|Any CPU
347+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x64.Build.0 = Release|Any CPU
348+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x86.ActiveCfg = Release|Any CPU
349+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9}.Release|x86.Build.0 = Release|Any CPU
326350
{BA4579AF-9C20-477A-891B-926968B11C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
327351
{BA4579AF-9C20-477A-891B-926968B11C68}.Debug|Any CPU.Build.0 = Debug|Any CPU
328352
{BA4579AF-9C20-477A-891B-926968B11C68}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -863,6 +887,18 @@ Global
863887
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}.Release|x64.Build.0 = Release|Any CPU
864888
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}.Release|x86.ActiveCfg = Release|Any CPU
865889
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430}.Release|x86.Build.0 = Release|Any CPU
890+
{396E6929-5365-4116-8AA8-DF5327247798}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
891+
{396E6929-5365-4116-8AA8-DF5327247798}.Debug|Any CPU.Build.0 = Debug|Any CPU
892+
{396E6929-5365-4116-8AA8-DF5327247798}.Debug|x64.ActiveCfg = Debug|Any CPU
893+
{396E6929-5365-4116-8AA8-DF5327247798}.Debug|x64.Build.0 = Debug|Any CPU
894+
{396E6929-5365-4116-8AA8-DF5327247798}.Debug|x86.ActiveCfg = Debug|Any CPU
895+
{396E6929-5365-4116-8AA8-DF5327247798}.Debug|x86.Build.0 = Debug|Any CPU
896+
{396E6929-5365-4116-8AA8-DF5327247798}.Release|Any CPU.ActiveCfg = Release|Any CPU
897+
{396E6929-5365-4116-8AA8-DF5327247798}.Release|Any CPU.Build.0 = Release|Any CPU
898+
{396E6929-5365-4116-8AA8-DF5327247798}.Release|x64.ActiveCfg = Release|Any CPU
899+
{396E6929-5365-4116-8AA8-DF5327247798}.Release|x64.Build.0 = Release|Any CPU
900+
{396E6929-5365-4116-8AA8-DF5327247798}.Release|x86.ActiveCfg = Release|Any CPU
901+
{396E6929-5365-4116-8AA8-DF5327247798}.Release|x86.Build.0 = Release|Any CPU
866902
EndGlobalSection
867903
GlobalSection(SolutionProperties) = preSolution
868904
HideSolutionNode = FALSE
@@ -882,6 +918,7 @@ Global
882918
{D2E8AC42-2751-4AF9-87E4-54A8B2034360} = {6EAC4D2C-4A86-4C9F-8427-CB374F69F08C}
883919
{1A6A0104-F610-4DD3-88BE-C4029034E5DA} = {BF4543A8-0731-4FDD-BB6B-0ADB9561F981}
884920
{34A46D97-5996-46B3-BDCA-631EDAA0E210} = {FA350BD6-C29D-40D9-BA47-FE5FBDFC84A0}
921+
{D4E5F6A7-B8C9-4D0E-A236-B4C5D6E7F8A9} = {FA350BD6-C29D-40D9-BA47-FE5FBDFC84A0}
885922
{BA4579AF-9C20-477A-891B-926968B11C68} = {F6F48227-B3C5-4A51-B33F-FF9AD96352DB}
886923
{6F24BF9C-EA4E-42AB-A9A8-435CE69362B8} = {F6F48227-B3C5-4A51-B33F-FF9AD96352DB}
887924
{64775F93-5A04-495F-97C6-BDB3835B18F6} = {F6F48227-B3C5-4A51-B33F-FF9AD96352DB}
@@ -926,6 +963,10 @@ Global
926963
{E0B26803-010B-4198-8016-002242076B61} = {583FFBBD-421C-4FB7-BBDA-F9CAF35A354A}
927964
{136F1E35-8B20-465C-8D42-30A5A0D0DA1F} = {583FFBBD-421C-4FB7-BBDA-F9CAF35A354A}
928965
{12C4A556-E62E-4EC0-BCD9-E9D4E1F3D430} = {BF4543A8-0731-4FDD-BB6B-0ADB9561F981}
966+
{396E6929-5365-4116-8AA8-DF5327247798} = {6360202A-F931-4BBD-ADBD-C9A628EE59F8}
967+
{03997797-E7F5-0643-168D-B8EA7178C2FE} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
968+
{EC447DCF-ABFA-6E24-52A5-D7FD48A5C558} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
969+
{CC1F4FA2-92F2-BA4B-815B-7EC2CBBCCF50} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
929970
EndGlobalSection
930971
GlobalSection(ExtensibilityGlobals) = postSolution
931972
SolutionGuid = {88B478F4-FD3B-4C24-9E84-4FAAF0254397}

src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/BrandProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using AutoMapper;
1+
using Grand.Mapping;
22
using Grand.Business.Core.Dto;
33
using Grand.Domain.Catalog;
44
using Grand.Infrastructure.Mapper;

src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CategoryProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using AutoMapper;
1+
using Grand.Mapping;
22
using Grand.Business.Core.Dto;
33
using Grand.Domain.Catalog;
44
using Grand.Infrastructure.Mapper;

src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/CollectionProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using AutoMapper;
1+
using Grand.Mapping;
22
using Grand.Business.Core.Dto;
33
using Grand.Domain.Catalog;
44
using Grand.Infrastructure.Mapper;

src/Business/Grand.Business.Catalog/Services/ExportImport/Mapper/ProductProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using AutoMapper;
1+
using Grand.Mapping;
22
using Grand.Business.Core.Dto;
33
using Grand.Domain.Catalog;
44
using Grand.Infrastructure.Mapper;

src/Core/Grand.Infrastructure/Grand.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
99
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
1010
<PackageReference Include="Microsoft.Extensions.DependencyModel" />
11-
<PackageReference Include="AutoMapper" />
1211
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
1312
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" />
1413
<PackageReference Include="MediatR" />
@@ -20,5 +19,6 @@
2019
<ItemGroup>
2120
<ProjectReference Include="..\Grand.Data\Grand.Data.csproj" />
2221
<ProjectReference Include="..\Grand.Domain\Grand.Domain.csproj" />
22+
<ProjectReference Include="..\Grand.Mapping\Grand.Mapping.csproj" />
2323
</ItemGroup>
2424
</Project>

src/Core/Grand.Infrastructure/Mapper/AutoMapperConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using AutoMapper;
1+
using Grand.Mapping;
22

33
namespace Grand.Infrastructure.Mapper;
44

src/Core/Grand.Infrastructure/Mapper/MappingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public static class MappingExtensions
44
{
5-
public static TDestination MapTo<TSource, TDestination>(this TSource source)
5+
public static TDestination MapTo<TSource, TDestination>(this TSource source) where TDestination : new()
66
{
77
return AutoMapperConfig.Mapper.Map<TSource, TDestination>(source);
88
}

src/Core/Grand.Infrastructure/StartupBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using AutoMapper;
2-
using Grand.Data;
1+
using Grand.Data;
2+
using Grand.Mapping;
33
using Grand.Infrastructure.Configuration;
44
using Grand.Infrastructure.Extensions;
55
using Grand.Infrastructure.Mapper;
@@ -67,7 +67,7 @@ private static void InitAutoMapper(ITypeSearcher typeSearcher)
6767
//create AutoMapper configuration
6868
var config = new MapperConfiguration(cfg =>
6969
{
70-
foreach (var instance in instances) cfg.AddProfile(instance.GetType());
70+
foreach (var instance in instances) cfg.AddProfile((Grand.Mapping.Profile)instance);
7171
});
7272

7373
//register automapper

0 commit comments

Comments
 (0)