Skip to content

Commit

Permalink
Remove dependencies of Migration.Tool.Core.K11 on Migration.Tool.KXP
Browse files Browse the repository at this point in the history
Refactor: Remove dependencies of Migration.Tool.Core.K11 on Migration.Tool.KXP
  • Loading branch information
akfakmot committed Nov 15, 2024
1 parent 3324963 commit 0deb203
Show file tree
Hide file tree
Showing 17 changed files with 228 additions and 459 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum
s => s.UserGuid,
sourceUserId,
t => t.MemberID,
guid => MemberInfo.Provider.Get(guid)
MemberInfo.Provider.Get
) is { Success: true, Mapped: { } memberId })
{
return ValueInterceptorResult.ReplaceValue(memberId);
Expand Down
6 changes: 3 additions & 3 deletions Migration.Tool.Core.KX13/Contexts/KeyMappingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ public class KeyMappingContext(PrimaryKeyMappingContext primaryKeyMappingContext
public MapSourceKeyResult<TTargetKey> MapSourceKey<TSource, TTarget, TTargetKey>(Expression<Func<TSource, object>> sourceKeySelector,
Expression<Func<TSource, Guid>> sourceGuidSelector,
object? sourceKey,
Expression<Func<TTarget, TTargetKey>> targetKeySelector,
Expression<Func<TTarget, Guid>> targetGuidSelector) where TSource : class where TTarget : class
Func<TTarget, TTargetKey> targetKeySelector,
Func<Guid, TTarget?> targetByGuidProvider) where TSource : class where TTarget : class
{
if (sourceKey is int id && primaryKeyMappingContext.MapSourceId(sourceKeySelector, id) is { Success: true, MappedId: TTargetKey targetKey })
{
return new MapSourceKeyResult<TTargetKey>(true, targetKey);
}

if (keyLocatorService.TryLocate(sourceKeySelector, targetKeySelector, sourceGuidSelector, targetGuidSelector, sourceKey, out var located))
if (keyLocatorService.TryLocate(sourceKeySelector, targetKeySelector, sourceGuidSelector, targetByGuidProvider, sourceKey, out var located))
{
return new MapSourceKeyResult<TTargetKey>(true, located);
}
Expand Down
14 changes: 7 additions & 7 deletions Migration.Tool.Core.KX13/DependencyInjectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using CMS.ContactManagement;
using CMS.DataEngine;
using CMS.DataProtection;
using CMS.FormEngine;
using CMS.Globalization;
using CMS.MediaLibrary;
Expand All @@ -18,7 +20,6 @@
using Migration.Tool.Core.KX13.Helpers;
using Migration.Tool.Core.KX13.Mappers;
using Migration.Tool.Core.KX13.Services;
using Migration.Tool.KXP.Models;

namespace Migration.Tool.Core.KX13;

Expand Down Expand Up @@ -47,18 +48,17 @@ public static IServiceCollection UseKx13ToolCore(this IServiceCollection service

// mappers
services.AddTransient<IEntityMapper<CmsAttachmentMapperSource, MediaFileInfo>, CmsAttachmentMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsConsent, CmsConsent>, CmsConsentMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsConsentAgreement, CmsConsentAgreement>, CmsConsentAgreementMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsConsentArchive, CmsConsentArchive>, CmsConsentArchiveMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsConsent, ConsentInfo>, CmsConsentMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsConsentAgreement, ConsentAgreementInfo>, CmsConsentAgreementMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsConsentArchive, ConsentArchiveInfo>, CmsConsentArchiveMapper>();
services.AddTransient<IEntityMapper<AlternativeFormMapperSource, AlternativeFormInfo>, AlternativeFormMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsRole, RoleInfo>, RoleInfoMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsSettingsCategory, CmsSettingsCategory>, CmsSettingsCategoryMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsSettingsKey, SettingsKeyInfo>, CmsSettingsKeyMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsUser, UserInfo>, UserInfoMapper>();
services.AddTransient<IEntityMapper<MemberInfoMapperSource, MemberInfo>, MemberInfoMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsUserRole, UserRoleInfo>, UserRoleInfoMapper>();
services.AddTransient<IEntityMapper<KX13M.OmContactGroup, OmContactGroup>, OmContactGroupMapper>();
services.AddTransient<IEntityMapper<KX13M.OmContactStatus, OmContactStatus>, OmContactStatusMapper>();
services.AddTransient<IEntityMapper<KX13M.OmContactGroup, ContactGroupInfo>, OmContactGroupMapper>();
services.AddTransient<IEntityMapper<KX13M.OmContactStatus, ContactStatusInfo>, OmContactStatusMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsCountry, CountryInfo>, CountryInfoMapper>();
services.AddTransient<IEntityMapper<KX13M.CmsState, StateInfo>, StateInfoMapper>();

Expand Down
Loading

0 comments on commit 0deb203

Please sign in to comment.