From 60f817b18c3e2a143a634fd362f2feaafed4e3a4 Mon Sep 17 00:00:00 2001 From: akfakmot Date: Wed, 13 Nov 2024 09:06:40 +0100 Subject: [PATCH 01/10] Remove Migration.Tool.KXP dependency from MigrateContactManagementCommandHandler Refactor: Remove Migration.Tool.KXP dependency from MigrateContactManagementCommandHandler --- .../MigrateContactManagementCommandHandler.cs | 140 +++++++++--------- 1 file changed, 66 insertions(+), 74 deletions(-) diff --git a/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs index b2c864a5..2bf62657 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs @@ -1,10 +1,10 @@ using CMS.Activities; using CMS.ContactManagement; using CMS.ContentEngine; - +using CMS.Globalization; +using CMS.Membership; using MediatR; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; @@ -17,14 +17,11 @@ using Migration.Tool.Core.K11.Services; using Migration.Tool.K11.Models; using Migration.Tool.KXP.Api; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.K11.Handlers; public class MigrateContactManagementCommandHandler( ILogger logger, - IDbContextFactory kxpContextFactory, BulkDataCopyService bulkDataCopyService, ToolConfiguration toolConfiguration, PrimaryKeyMappingContext primaryKeyMappingContext, @@ -33,12 +30,8 @@ public class MigrateContactManagementCommandHandler( KxpClassFacade kxpClassFacade, ISpoiledGuidContext spoiledGuidContext, IProtocol protocol) - : IRequestHandler, IDisposable + : IRequestHandler { - private readonly KxpContext kxpContext = kxpContextFactory.CreateDbContext(); - - public void Dispose() => kxpContext.Dispose(); - public Task Handle(MigrateContactManagementCommand request, CancellationToken cancellationToken) { countryMigrator.MigrateCountriesAndStates(); @@ -62,35 +55,35 @@ public Task Handle(MigrateContactManagementCommand request, Cance { var requiredColumnsForContactMigration = new Dictionary { - { nameof(Tool.K11.Models.OmContact.ContactId), nameof(KXP.Models.OmContact.ContactId) }, - { nameof(Tool.K11.Models.OmContact.ContactFirstName), nameof(KXP.Models.OmContact.ContactFirstName) }, - { nameof(Tool.K11.Models.OmContact.ContactMiddleName), nameof(KXP.Models.OmContact.ContactMiddleName) }, - { nameof(Tool.K11.Models.OmContact.ContactLastName), nameof(KXP.Models.OmContact.ContactLastName) }, - { nameof(Tool.K11.Models.OmContact.ContactJobTitle), nameof(KXP.Models.OmContact.ContactJobTitle) }, - { nameof(Tool.K11.Models.OmContact.ContactAddress1), nameof(KXP.Models.OmContact.ContactAddress1) }, - { nameof(Tool.K11.Models.OmContact.ContactCity), nameof(KXP.Models.OmContact.ContactCity) }, - { nameof(Tool.K11.Models.OmContact.ContactZip), nameof(KXP.Models.OmContact.ContactZip) }, - { nameof(Tool.K11.Models.OmContact.ContactStateId), nameof(KXP.Models.OmContact.ContactStateId) }, - { nameof(Tool.K11.Models.OmContact.ContactCountryId), nameof(KXP.Models.OmContact.ContactCountryId) }, - { nameof(Tool.K11.Models.OmContact.ContactMobilePhone), nameof(KXP.Models.OmContact.ContactMobilePhone) }, - { nameof(Tool.K11.Models.OmContact.ContactBusinessPhone), nameof(KXP.Models.OmContact.ContactBusinessPhone) }, - { nameof(Tool.K11.Models.OmContact.ContactEmail), nameof(KXP.Models.OmContact.ContactEmail) }, + { nameof(OmContact.ContactId), nameof(ContactInfo.ContactID) }, + { nameof(OmContact.ContactFirstName), nameof(ContactInfo.ContactFirstName) }, + { nameof(OmContact.ContactMiddleName), nameof(ContactInfo.ContactMiddleName) }, + { nameof(OmContact.ContactLastName), nameof(ContactInfo.ContactLastName) }, + { nameof(OmContact.ContactJobTitle), nameof(ContactInfo.ContactJobTitle) }, + { nameof(OmContact.ContactAddress1), nameof(ContactInfo.ContactAddress1) }, + { nameof(OmContact.ContactCity), nameof(ContactInfo.ContactCity) }, + { nameof(OmContact.ContactZip), nameof(ContactInfo.ContactZIP) }, + { nameof(OmContact.ContactStateId), nameof(ContactInfo.ContactStateID) }, + { nameof(OmContact.ContactCountryId), nameof(ContactInfo.ContactCountryID) }, + { nameof(OmContact.ContactMobilePhone), nameof(ContactInfo.ContactMobilePhone) }, + { nameof(OmContact.ContactBusinessPhone), nameof(ContactInfo.ContactBusinessPhone) }, + { nameof(OmContact.ContactEmail), nameof(ContactInfo.ContactEmail) }, // No support 2022-07-07 { nameof(OmContact.ContactBirthday), nameof(KXO.Models.OmContact.ContactBirthday) }, - { nameof(Tool.K11.Models.OmContact.ContactGender), nameof(KXP.Models.OmContact.ContactGender) }, + { nameof(OmContact.ContactGender), nameof(ContactInfo.ContactGender) }, // { nameof(OmContact.ContactStatusId), nameof(KXO.Models.OmContact.ContactStatusId) }, // No support 2022-07-07 but needs to be mapped because of constraint - { nameof(Tool.K11.Models.OmContact.ContactNotes), nameof(KXP.Models.OmContact.ContactNotes) }, - { nameof(Tool.K11.Models.OmContact.ContactOwnerUserId), nameof(KXP.Models.OmContact.ContactOwnerUserId) }, + { nameof(OmContact.ContactNotes), nameof(ContactInfo.ContactNotes) }, + { nameof(OmContact.ContactOwnerUserId), nameof(ContactInfo.ContactOwnerUserID) }, // No support 2022-07-07 { nameof(OmContact.ContactMonitored), nameof(KXO.Models.OmContact.ContactMonitored) }, - { nameof(Tool.K11.Models.OmContact.ContactGuid), nameof(KXP.Models.OmContact.ContactGuid) }, - { nameof(Tool.K11.Models.OmContact.ContactLastModified), nameof(KXP.Models.OmContact.ContactLastModified) }, - { nameof(Tool.K11.Models.OmContact.ContactCreated), nameof(KXP.Models.OmContact.ContactCreated) }, + { nameof(OmContact.ContactGuid), nameof(ContactInfo.ContactGUID) }, + { nameof(OmContact.ContactLastModified), nameof(ContactInfo.ContactLastModified) }, + { nameof(OmContact.ContactCreated), nameof(ContactInfo.ContactCreated) }, // No support 2022-07-07 { nameof(OmContact.ContactBounces), nameof(KXO.Models.OmContact.ContactBounces) }, - { nameof(Tool.K11.Models.OmContact.ContactCampaign), nameof(KXP.Models.OmContact.ContactCampaign) }, + { nameof(OmContact.ContactCampaign), nameof(ContactInfo.ContactCampaign) }, // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadId), nameof(KXO.Models.OmContact.ContactSalesForceLeadId) }, // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationDisabled), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDisabled) }, // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDateTime) }, // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationSuspensionDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationSuspensionDateTime) }, - { nameof(Tool.K11.Models.OmContact.ContactCompanyName), nameof(KXP.Models.OmContact.ContactCompanyName) } + { nameof(OmContact.ContactCompanyName), nameof(ContactInfo.ContactCompanyName) } // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationRequired), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationRequired) }, }; @@ -119,9 +112,9 @@ public Task Handle(MigrateContactManagementCommand request, Cance } } - primaryKeyMappingContext.PreloadDependencies(u => u.UserId); - primaryKeyMappingContext.PreloadDependencies(u => u.StateId); - primaryKeyMappingContext.PreloadDependencies(u => u.CountryId); + primaryKeyMappingContext.PreloadDependencies(u => u.UserId); + primaryKeyMappingContext.PreloadDependencies(u => u.StateId); + primaryKeyMappingContext.PreloadDependencies(u => u.CountryId); var bulkCopyRequest = new BulkCopyRequest("OM_Contact", s => true, // s => s != "ContactID", @@ -149,7 +142,7 @@ public Task Handle(MigrateContactManagementCommand request, Cance private ValueInterceptorResult ContactValueInterceptor(int ordinal, string columnName, object value, Dictionary currentRow) { - if (columnName.Equals(nameof(KXP.Models.OmContact.ContactCompanyName), StringComparison.InvariantCultureIgnoreCase)) + if (columnName.Equals(nameof(ContactInfo.ContactCompanyName), StringComparison.InvariantCultureIgnoreCase)) { // autofix removed in favor of error report and data consistency // var truncatedValue = SqlDataTypeHelper.TruncateString(value, 100); @@ -171,27 +164,27 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(KXP.Models.OmContact.ContactOwnerUserId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceUserId) + if (columnName.Equals(nameof(ContactInfo.ContactOwnerUserID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceUserId) { - switch (primaryKeyMappingContext.MapSourceId(u => u.UserId, sourceUserId)) + switch (primaryKeyMappingContext.MapSourceId(u => u.UserId, sourceUserId)) { case (true, var id): return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { // try search member - if (keyMappingContext.MapSourceKey( + if (keyMappingContext.MapSourceKey( s => s.UserId, s => s.UserGuid, sourceUserId, - t => t.MemberId, + t => t.MemberID, t => t.MemberGuid ) is { Success: true, Mapped: { } memberId }) { return ValueInterceptorResult.ReplaceValue(memberId); } - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -201,15 +194,15 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(KXP.Models.OmContact.ContactStateId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceStateId) + if (columnName.Equals(nameof(ContactInfo.ContactStateID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceStateId) { - switch (primaryKeyMappingContext.MapSourceId(u => u.StateId, sourceStateId.NullIfZero())) + switch (primaryKeyMappingContext.MapSourceId(u => u.StateId, sourceStateId.NullIfZero())) { case (true, var id): return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -219,15 +212,15 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(KXP.Models.OmContact.ContactCountryId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceCountryId) + if (columnName.Equals(nameof(ContactInfo.ContactCountryID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceCountryId) { - switch (primaryKeyMappingContext.MapSourceId(u => u.CountryId, sourceCountryId.NullIfZero())) + switch (primaryKeyMappingContext.MapSourceId(u => u.CountryId, sourceCountryId.NullIfZero())) { case (true, var id): return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -244,30 +237,29 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum #endregion #region "Migrate contact activities" - private CommandResult? MigrateContactActivities() { var requiredColumnsForContactMigration = new Dictionary { - { nameof(Tool.K11.Models.OmActivity.ActivityId), nameof(KXP.Models.OmActivity.ActivityId) }, - { nameof(Tool.K11.Models.OmActivity.ActivityContactId), nameof(KXP.Models.OmActivity.ActivityContactId) }, - { nameof(Tool.K11.Models.OmActivity.ActivityCreated), nameof(KXP.Models.OmActivity.ActivityCreated) }, - { nameof(Tool.K11.Models.OmActivity.ActivityType), nameof(KXP.Models.OmActivity.ActivityType) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityItemId), nameof(KXO.Models.OmActivity.ActivityItemId) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityItemDetailId), nameof(KXO.Models.OmActivity.ActivityItemDetailId) }, - { nameof(Tool.K11.Models.OmActivity.ActivityValue), nameof(KXP.Models.OmActivity.ActivityValue) }, - { nameof(Tool.K11.Models.OmActivity.ActivityUrl), nameof(KXP.Models.OmActivity.ActivityUrl) }, - { nameof(Tool.K11.Models.OmActivity.ActivityTitle), nameof(KXP.Models.OmActivity.ActivityTitle) }, - { nameof(Tool.K11.Models.OmActivity.ActivitySiteId), nameof(KXP.Models.OmActivity.ActivityChannelId) }, - { nameof(Tool.K11.Models.OmActivity.ActivityComment), nameof(KXP.Models.OmActivity.ActivityComment) }, - // { nameof(OmActivity.ActivityCampaign), nameof(KXP.Models.OmActivity.ActivityCampaign) }, // deprecated without replacement in v27 - { nameof(Tool.K11.Models.OmActivity.ActivityUrlreferrer), nameof(KXP.Models.OmActivity.ActivityUrlreferrer) }, - { nameof(Tool.K11.Models.OmActivity.ActivityCulture), nameof(KXP.Models.OmActivity.ActivityLanguageId) }, - { nameof(Tool.K11.Models.OmActivity.ActivityNodeId), nameof(KXP.Models.OmActivity.ActivityWebPageItemGuid) }, - { nameof(Tool.K11.Models.OmActivity.ActivityUtmsource), nameof(KXP.Models.OmActivity.ActivityUtmsource) }, + { nameof(OmActivity.ActivityId), nameof(ActivityInfo.ActivityID) }, + { nameof(OmActivity.ActivityContactId), nameof(ActivityInfo.ActivityContactID) }, + { nameof(OmActivity.ActivityCreated), nameof(ActivityInfo.ActivityCreated) }, + { nameof(OmActivity.ActivityType), nameof(ActivityInfo.ActivityType) }, + // No support 2022-07-07 { nameof(OmActivity.ActivityItemID), nameof(KXO.Models.OmActivity.ActivityItemID) }, + // No support 2022-07-07 { nameof(OmActivity.ActivityItemDetailID), nameof(KXO.Models.OmActivity.ActivityItemDetailID) }, + { nameof(OmActivity.ActivityValue), nameof(ActivityInfo.ActivityValue) }, + { nameof(OmActivity.ActivityUrl), nameof(ActivityInfo.ActivityURL) }, + { nameof(OmActivity.ActivityTitle), nameof(ActivityInfo.ActivityTitle) }, + { nameof(OmActivity.ActivitySiteId), nameof(ActivityInfo.ActivityChannelID) }, + { nameof(OmActivity.ActivityComment), nameof(ActivityInfo.ActivityComment) }, + // { nameof(OmActivity.ActivityCampaign), nameof(ActivityInfo.ActivityCampaign) }, // deprecated without replacement in v27 + { nameof(OmActivity.ActivityUrlreferrer), nameof(ActivityInfo.ActivityURLReferrer) }, + { nameof(OmActivity.ActivityCulture), nameof(ActivityInfo.ActivityLanguageID) }, + { nameof(OmActivity.ActivityNodeId), nameof(ActivityInfo.ActivityWebPageItemGUID) }, + { nameof(OmActivity.ActivityUtmsource), nameof(ActivityInfo.ActivityUTMSource) }, // No support 2022-07-07 { nameof(OmActivity.ActivityAbvariantName), nameof(KXO.Models.OmActivity.ActivityAbvariantName) }, - // OBSOLETE 26.0.0: { nameof(OmActivity.ActivityUrlhash), nameof(KXP.Models.OmActivity.ActivityUrlhash) }, - { nameof(Tool.K11.Models.OmActivity.ActivityUtmcontent), nameof(KXP.Models.OmActivity.ActivityUtmcontent) } + // OBSOLETE 26.0.0: { nameof(OmActivity.ActivityUrlhash), nameof(ActivityInfo.ActivityUrlhash) }, + { nameof(OmActivity.ActivityUtmcontent), nameof(ActivityInfo.ActivityUTMContent) } }; foreach (var cfi in kxpClassFacade.GetCustomizedFieldInfos(ActivityInfo.TYPEINFO.ObjectClassName)) @@ -309,15 +301,15 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, string columnName, object value, Dictionary currentRow) { - if (columnName.Equals(nameof(Tool.K11.Models.OmActivity.ActivitySiteId), StringComparison.InvariantCultureIgnoreCase) && + if (columnName.Equals(nameof(OmActivity.ActivitySiteId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceActivitySiteId) { - var result = keyMappingContext.MapSourceKey( + var result = keyMappingContext.MapSourceKey( s => s.SiteId, s => s.SiteGuid, sourceActivitySiteId.NullIfZero(), - t => t.ChannelId, - t => t.ChannelGuid + t => t.ChannelID, + t => t.ChannelGUID ); switch (result) { @@ -336,7 +328,7 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) + .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; @@ -348,9 +340,9 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin } } - if (columnName.Equals(nameof(Tool.K11.Models.OmActivity.ActivityNodeId), StringComparison.InvariantCultureIgnoreCase) && value is int activityNodeId) + if (columnName.Equals(nameof(OmActivity.ActivityNodeId), StringComparison.InvariantCultureIgnoreCase) && value is int activityNodeId) { - if (currentRow.TryGetValue(nameof(Tool.K11.Models.OmActivity.ActivitySiteId), out object? mSiteId) && mSiteId is int siteId) + if (currentRow.TryGetValue(nameof(OmActivity.ActivitySiteId), out object? mSiteId) && mSiteId is int siteId) { if (spoiledGuidContext.GetNodeGuid(siteId, activityNodeId) is { } nodeGuid) { @@ -369,14 +361,14 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) + .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; } } - if (columnName.Equals(nameof(KXP.Models.OmActivity.ActivityLanguageId), StringComparison.InvariantCultureIgnoreCase) && value is string cultureCode) + if (columnName.Equals(nameof(ActivityInfo.ActivityLanguageID), StringComparison.InvariantCultureIgnoreCase) && value is string cultureCode) { return ValueInterceptorResult.ReplaceValue(ContentLanguageInfoProvider.ProviderObject.Get(cultureCode)?.ContentLanguageID); } From c7adf665578c37f91c321e478cfabc4482f6c694 Mon Sep 17 00:00:00 2001 From: akfakmot Date: Wed, 13 Nov 2024 12:24:55 +0100 Subject: [PATCH 02/10] Remove KXP dependency from K11 MigrateDataProtectionCommandHandler Refactor: Remove KXP dependency from K11 MigrateDataProtectionCommandHandler --- .../MigrateDataProtectionCommandHandler.cs | 189 ++++-------------- .../K11CoreDiExtensions.cs | 7 +- .../Mappers/CmsConsentAgreementMapper.cs | 13 +- .../Mappers/CmsConsentArchiveMapper.cs | 9 +- .../Mappers/CmsConsentMapper.cs | 9 +- 5 files changed, 56 insertions(+), 171 deletions(-) diff --git a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs index f8a82f84..4e107eed 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs @@ -1,3 +1,5 @@ +using CMS.ContactManagement; +using CMS.DataEngine; using CMS.DataProtection; using MediatR; @@ -16,43 +18,17 @@ namespace Migration.Tool.Core.K11.Handlers; -public class MigrateDataProtectionCommandHandler : IRequestHandler, IDisposable +public class MigrateDataProtectionCommandHandler( + ILogger logger, + IDbContextFactory k11ContextFactory, + IEntityMapper consentAgreementMapper, + IEntityMapper consentArchiveMapper, + IEntityMapper consentMapper, + PrimaryKeyMappingContext primaryKeyMappingContext, + IProtocol protocol + ) : IRequestHandler { private static readonly int batchSize = 1000; - private readonly IEntityMapper consentAgreementMapper; - private readonly IEntityMapper consentArchiveMapper; - private readonly IEntityMapper consentMapper; - private readonly IDbContextFactory k11ContextFactory; - private readonly IDbContextFactory kxpContextFactory; - private readonly ILogger logger; - private readonly PrimaryKeyMappingContext primaryKeyMappingContext; - private readonly IProtocol protocol; - - private KxpContext kxpContext; - - public MigrateDataProtectionCommandHandler( - ILogger logger, - IDbContextFactory kxpContextFactory, - IDbContextFactory k11ContextFactory, - IEntityMapper consentMapper, - IEntityMapper consentArchiveMapper, - IEntityMapper consentAgreementMapper, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol - ) - { - this.logger = logger; - this.kxpContextFactory = kxpContextFactory; - this.k11ContextFactory = k11ContextFactory; - this.consentMapper = consentMapper; - this.consentArchiveMapper = consentArchiveMapper; - this.consentAgreementMapper = consentAgreementMapper; - this.primaryKeyMappingContext = primaryKeyMappingContext; - this.protocol = protocol; - kxpContext = this.kxpContextFactory.CreateDbContext(); - } - - public void Dispose() => kxpContext.Dispose(); public async Task Handle(MigrateDataProtectionCommand request, CancellationToken cancellationToken) { @@ -72,7 +48,7 @@ private async Task MigrateConsent(CancellationToken cancellationT protocol.FetchedSource(k11Consent); logger.LogTrace("Migrating consent {ConsentName} with ConsentGuid {ConsentGuid}", k11Consent.ConsentName, k11Consent.ConsentGuid); - var kxoConsent = await kxpContext.CmsConsents.FirstOrDefaultAsync(consent => consent.ConsentGuid == k11Consent.ConsentGuid, cancellationToken); + var kxoConsent = ConsentInfo.Provider.Get().WhereEquals(nameof(ConsentInfo.ConsentGuid), k11Consent.ConsentGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsent); var mapped = consentMapper.Map(k11Consent, kxoConsent); @@ -80,38 +56,13 @@ private async Task MigrateConsent(CancellationToken cancellationT if (mapped is { Success: true } result) { - (var cmsConsent, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsent, nameof(cmsConsent)); - - if (newInstance) - { - kxpContext.CmsConsents.Add(cmsConsent); - } - else - { - kxpContext.CmsConsents.Update(cmsConsent); - } + (var consentInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(consentInfo, nameof(consentInfo)); - try - { - await kxpContext.SaveChangesAsync(cancellationToken); - - protocol.Success(k11Consent, cmsConsent, mapped); - logger.LogEntitySetAction(newInstance, cmsConsent); - primaryKeyMappingContext.SetMapping(r => r.ConsentId, k11Consent.ConsentId, cmsConsent.ConsentId); - } - /*Violation in unique index or Violation in unique constraint */ - catch (DbUpdateException dbUpdateException) when (dbUpdateException.InnerException is SqlException { Number: 2601 or 2627 } sqlException) - { - logger.LogEntitySetError(sqlException, newInstance, k11Consent); - protocol.Append(HandbookReferences - .DbConstraintBroken(sqlException, k11Consent) - .WithMessage("Failed to migrate consent, target database constraint broken.") - ); - - await kxpContext.DisposeAsync(); - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - } + ConsentInfo.Provider.Set(consentInfo); + protocol.Success(k11Consent, consentInfo, mapped); + logger.LogEntitySetAction(newInstance, consentInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentId, k11Consent.ConsentId, consentInfo.ConsentID); } } @@ -127,7 +78,7 @@ private async Task MigrateConsentArchive(CancellationToken cancel protocol.FetchedSource(k11ArchiveConsent); logger.LogTrace("Migrating consent archive with ConsentArchiveGuid {ConsentGuid}", k11ArchiveConsent.ConsentArchiveGuid); - var kxoConsentArchive = await kxpContext.CmsConsentArchives.FirstOrDefaultAsync(consentArchive => consentArchive.ConsentArchiveGuid == k11ArchiveConsent.ConsentArchiveGuid, cancellationToken); + var kxoConsentArchive = ConsentArchiveInfo.Provider.Get().WhereEquals(nameof(ConsentArchiveInfo.ConsentArchiveGuid), k11ArchiveConsent.ConsentArchiveGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsentArchive); var mapped = consentArchiveMapper.Map(k11ArchiveConsent, kxoConsentArchive); @@ -135,39 +86,14 @@ private async Task MigrateConsentArchive(CancellationToken cancel if (mapped is { Success: true } result) { - (var cmsConsentArchive, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsentArchive, nameof(cmsConsentArchive)); - - if (newInstance) - { - kxpContext.CmsConsentArchives.Add(cmsConsentArchive); - } - else - { - kxpContext.CmsConsentArchives.Update(cmsConsentArchive); - } - - try - { - await kxpContext.SaveChangesAsync(cancellationToken); - - protocol.Success(k11ArchiveConsent, cmsConsentArchive, mapped); - logger.LogEntitySetAction(newInstance, cmsConsentArchive); - primaryKeyMappingContext.SetMapping(r => r.ConsentArchiveGuid, - k11ArchiveConsent.ConsentArchiveId, cmsConsentArchive.ConsentArchiveId); - } - /*Violation in unique index or Violation in unique constraint */ - catch (DbUpdateException dbUpdateException) when (dbUpdateException.InnerException is SqlException { Number: 2601 or 2627 } sqlException) - { - logger.LogEntitySetError(sqlException, newInstance, k11ArchiveConsent); - protocol.Append(HandbookReferences - .DbConstraintBroken(sqlException, k11ArchiveConsent) - .WithMessage("Failed to migrate consent archive, target database constraint broken.") - ); - - await kxpContext.DisposeAsync(); - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - } + (var consentArchiveInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(consentArchiveInfo, nameof(consentArchiveInfo)); + + ConsentArchiveInfo.Provider.Set(consentArchiveInfo); + protocol.Success(k11ArchiveConsent, consentArchiveInfo, mapped); + logger.LogEntitySetAction(newInstance, consentArchiveInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentArchiveGuid, + k11ArchiveConsent.ConsentArchiveId, consentArchiveInfo.ConsentArchiveID); } } @@ -179,8 +105,8 @@ private async Task MigrateConsentAgreement(CancellationToken canc await using var k11Context = await k11ContextFactory.CreateDbContextAsync(cancellationToken); int index = 0; int indexFull = 0; - var consentAgreementUpdates = new List(); - var consentAgreementNews = new List(); + var consentAgreementUpdates = new List(); + var consentAgreementNews = new List(); int itemsCount = k11Context.CmsConsentAgreements.Count(); foreach (var k11ConsentAgreement in k11Context.CmsConsentAgreements) @@ -188,7 +114,7 @@ private async Task MigrateConsentAgreement(CancellationToken canc protocol.FetchedSource(k11ConsentAgreement); logger.LogTrace("Migrating consent agreement with ConsentAgreementGuid {ConsentAgreementGuid}", k11ConsentAgreement.ConsentAgreementGuid); - var kxoConsentAgreement = await kxpContext.CmsConsentAgreements.FirstOrDefaultAsync(consentAgreement => consentAgreement.ConsentAgreementGuid == k11ConsentAgreement.ConsentAgreementGuid, cancellationToken); + var kxoConsentAgreement = ConsentAgreementInfo.Provider.Get().WhereEquals(nameof(ConsentAgreementInfo.ConsentAgreementGuid), k11ConsentAgreement.ConsentAgreementGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsentAgreement); var mapped = consentAgreementMapper.Map(k11ConsentAgreement, kxoConsentAgreement); @@ -196,16 +122,16 @@ private async Task MigrateConsentAgreement(CancellationToken canc if (mapped is { Success: true } result) { - (var cmsConsentAgreement, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsentAgreement, nameof(cmsConsentAgreement)); - + (var agreementInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(agreementInfo, nameof(agreementInfo)); + if (newInstance) { - consentAgreementNews.Add(cmsConsentAgreement); + consentAgreementNews.Add(agreementInfo); } else { - consentAgreementUpdates.Add(cmsConsentAgreement); + ConsentAgreementInfo.Provider.Set(agreementInfo); } } @@ -214,58 +140,15 @@ private async Task MigrateConsentAgreement(CancellationToken canc if (index == batchSize || indexFull == itemsCount) { - kxpContext.CmsConsentAgreements.AddRange(consentAgreementNews); - kxpContext.CmsConsentAgreements.UpdateRange(consentAgreementUpdates); - try { - await kxpContext.SaveChangesAsync(cancellationToken); - + ConsentAgreementInfo.Provider.BulkInsert(consentAgreementNews); foreach (var newK11ConsentAgreement in consentAgreementNews) { protocol.Success(k11ConsentAgreement, newK11ConsentAgreement, mapped); logger.LogDebug("CmsConsentAgreement: with ConsentAgreementGuid \'{ConsentAgreementGuid}\' was inserted", newK11ConsentAgreement.ConsentAgreementGuid); } - - foreach (var updateK11ConsentAgreement in consentAgreementUpdates) - { - protocol.Success(k11ConsentAgreement, updateK11ConsentAgreement, mapped); - logger.LogDebug("CmsConsentAgreement: with ConsentAgreementGuid \'{ConsentAgreementGuid}\' was updated", - updateK11ConsentAgreement.ConsentAgreementGuid); - } - } - catch (DbUpdateException dbUpdateException) when ( - dbUpdateException.InnerException is SqlException sqlException && - sqlException.Message.Contains("Cannot insert duplicate key row in object") - ) - { - await kxpContext.DisposeAsync(); - - protocol.Append(HandbookReferences - .ErrorCreatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrints(consentAgreementNews) - ); - logger.LogEntitiesSetError(dbUpdateException, true, consentAgreementNews); - - - protocol.Append(HandbookReferences - .ErrorUpdatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrints(consentAgreementUpdates) - ); - - var cai = ConsentAgreementInfo.New(); - protocol.Append(HandbookReferences - .ErrorUpdatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrint(cai) - ); - - logger.LogEntitiesSetError(dbUpdateException, false, consentAgreementUpdates); - - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); } finally { diff --git a/Migration.Tool.Core.K11/K11CoreDiExtensions.cs b/Migration.Tool.Core.K11/K11CoreDiExtensions.cs index 08bf7db8..987cdb80 100644 --- a/Migration.Tool.Core.K11/K11CoreDiExtensions.cs +++ b/Migration.Tool.Core.K11/K11CoreDiExtensions.cs @@ -1,4 +1,5 @@ using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; @@ -47,9 +48,9 @@ public static IServiceCollection UseK11ToolCore(this IServiceCollection services // mappers services.AddTransient, CmsAttachmentMapper>(); - services.AddTransient, CmsConsentMapper>(); - services.AddTransient, CmsConsentAgreementMapper>(); - services.AddTransient, CmsConsentArchiveMapper>(); + services.AddTransient, CmsConsentMapper>(); + services.AddTransient, CmsConsentAgreementMapper>(); + services.AddTransient, CmsConsentArchiveMapper>(); services.AddTransient, AlternativeFormMapper>(); services.AddTransient, RoleInfoMapper>(); services.AddTransient, CmsSettingsCategoryMapper>(); diff --git a/Migration.Tool.Core.K11/Mappers/CmsConsentAgreementMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsConsentAgreementMapper.cs index ba95658c..94cbdbcc 100644 --- a/Migration.Tool.Core.K11/Mappers/CmsConsentAgreementMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/CmsConsentAgreementMapper.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using CMS.DataProtection; +using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; @@ -8,11 +9,11 @@ namespace Migration.Tool.Core.K11.Mappers; public class CmsConsentAgreementMapper(ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) + : EntityMapperBase(logger, primaryKeyMappingContext, protocol) { - protected override KXP.Models.CmsConsentAgreement? CreateNewInstance(CmsConsentAgreement source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentAgreementInfo? CreateNewInstance(CmsConsentAgreement source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override KXP.Models.CmsConsentAgreement MapInternal(CmsConsentAgreement source, KXP.Models.CmsConsentAgreement target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + protected override ConsentAgreementInfo MapInternal(CmsConsentAgreement source, ConsentAgreementInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentAgreementGuid = source.ConsentAgreementGuid; target.ConsentAgreementRevoked = source.ConsentAgreementRevoked; @@ -21,12 +22,12 @@ protected override KXP.Models.CmsConsentAgreement MapInternal(CmsConsentAgreemen if (mappingHelper.TranslateRequiredId(c => c.ContactId, source.ConsentAgreementContactId, out int contactId)) { - target.ConsentAgreementContactId = contactId; + target.ConsentAgreementContactID = contactId; } if (mappingHelper.TranslateRequiredId(r => r.ConsentId, source.ConsentAgreementConsentId, out int consentId)) { - target.ConsentAgreementConsentId = consentId; + target.ConsentAgreementConsentID = consentId; } return target; diff --git a/Migration.Tool.Core.K11/Mappers/CmsConsentArchiveMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsConsentArchiveMapper.cs index 3e651447..6d771460 100644 --- a/Migration.Tool.Core.K11/Mappers/CmsConsentArchiveMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/CmsConsentArchiveMapper.cs @@ -1,3 +1,4 @@ +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; @@ -11,11 +12,11 @@ public class CmsConsentArchiveMapper( ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) + : EntityMapperBase(logger, primaryKeyMappingContext, protocol) { - protected override KXP.Models.CmsConsentArchive? CreateNewInstance(CmsConsentArchive source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentArchiveInfo? CreateNewInstance(CmsConsentArchive source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override KXP.Models.CmsConsentArchive MapInternal(CmsConsentArchive source, KXP.Models.CmsConsentArchive target, bool newInstance, + protected override ConsentArchiveInfo MapInternal(CmsConsentArchive source, ConsentArchiveInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentArchiveContent = source.ConsentArchiveContent; @@ -25,7 +26,7 @@ protected override KXP.Models.CmsConsentArchive MapInternal(CmsConsentArchive so if (mappingHelper.TranslateRequiredId(r => r.ConsentId, source.ConsentArchiveConsentId, out int consentId)) { - target.ConsentArchiveConsentId = consentId; + target.ConsentArchiveConsentID = consentId; } return target; diff --git a/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs index b6fa5e1f..1e138cdd 100644 --- a/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs @@ -3,7 +3,7 @@ using System.Xml.XPath; using CMS.ContentEngine; - +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; @@ -13,11 +13,11 @@ namespace Migration.Tool.Core.K11.Mappers; -public class CmsConsentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) +public class CmsConsentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) { - protected override KXP.Models.CmsConsent? CreateNewInstance(CmsConsent source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentInfo? CreateNewInstance(CmsConsent source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override KXP.Models.CmsConsent MapInternal(CmsConsent source, KXP.Models.CmsConsent target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + protected override ConsentInfo MapInternal(CmsConsent source, ConsentInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentDisplayName = source.ConsentDisplayName; var defaultContentLanguageInfo = ContentLanguageInfo.Provider.Get().WhereEquals(nameof(ContentLanguageInfo.ContentLanguageIsDefault), true).FirstOrDefault() ?? throw new InvalidCastException("Missing default content language"); @@ -25,7 +25,6 @@ protected override KXP.Models.CmsConsent MapInternal(CmsConsent source, KXP.Mode target.ConsentContent = ConsentContentPatcher.PatchConsentContent(source.ConsentContent, defaultContentLanguageInfo); target.ConsentGuid = source.ConsentGuid; target.ConsentLastModified = source.ConsentLastModified; - target.ConsentHash = source.ConsentHash; return target; } From 26c142d28cf93ee4ae17e9c5cd19694db79963c0 Mon Sep 17 00:00:00 2001 From: akfakmot Date: Wed, 13 Nov 2024 16:47:20 +0100 Subject: [PATCH 03/10] Remove dependencies of Migration.Tool.Core.K11 on Migration.Tool.KXP Refactor: Remove dependencies of Migration.Tool.Core.K11 on Migration.Tool.KXP --- .../Contexts/KeyMappingContext.cs | 8 +- .../MigrateContactManagementCommandHandler.cs | 4 +- .../MigrateDataProtectionCommandHandler.cs | 3 - .../Handlers/MigrateUsersCommandHandler.cs | 2 +- Migration.Tool.Core.K11/Helpers/Printer.cs | 33 ++++--- .../K11CoreDiExtensions.cs | 6 +- .../Mappers/CmsFormMapper.cs | 83 ---------------- .../Mappers/CmsSettingsCategoryMapper.cs | 97 ------------------- .../Mappers/CmsUserMapper.cs | 56 ----------- .../Mappers/OmContactGroupMapper.cs | 32 ++++-- .../Mappers/OmContactStatusMapper.cs | 7 +- .../Migration.Tool.Core.K11.csproj | 1 - .../Services/KeyLocatorService.cs | 46 ++++----- .../Services/PrimaryKeyLocatorService.cs | 74 +++++++------- 14 files changed, 118 insertions(+), 334 deletions(-) delete mode 100644 Migration.Tool.Core.K11/Mappers/CmsFormMapper.cs delete mode 100644 Migration.Tool.Core.K11/Mappers/CmsSettingsCategoryMapper.cs delete mode 100644 Migration.Tool.Core.K11/Mappers/CmsUserMapper.cs diff --git a/Migration.Tool.Core.K11/Contexts/KeyMappingContext.cs b/Migration.Tool.Core.K11/Contexts/KeyMappingContext.cs index 4079c931..fb01a299 100644 --- a/Migration.Tool.Core.K11/Contexts/KeyMappingContext.cs +++ b/Migration.Tool.Core.K11/Contexts/KeyMappingContext.cs @@ -1,5 +1,5 @@ using System.Linq.Expressions; - +using CMS.DataEngine; using Migration.Tool.Core.K11.Services; namespace Migration.Tool.Core.K11.Contexts; @@ -11,15 +11,15 @@ public class KeyMappingContext(PrimaryKeyMappingContext primaryKeyMappingContext public MapSourceKeyResult MapSourceKey(Expression> sourceKeySelector, Expression> sourceGuidSelector, object? sourceKey, - Expression> targetKeySelector, - Expression> targetGuidSelector) where TSource : class where TTarget : class + Func targetKeySelector, + Func targetByGuidProvider) where TSource : class where TTarget : AbstractInfoBase, new() { if (sourceKey is int id && primaryKeyMappingContext.MapSourceId(sourceKeySelector, id) is { Success: true, MappedId: TTargetKey targetKey }) { return new MapSourceKeyResult(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(true, located); } diff --git a/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs index 2bf62657..5e23d54b 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs @@ -178,7 +178,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum s => s.UserGuid, sourceUserId, t => t.MemberID, - t => t.MemberGuid + guid => MemberInfo.Provider.Get(guid) ) is { Success: true, Mapped: { } memberId }) { return ValueInterceptorResult.ReplaceValue(memberId); @@ -309,7 +309,7 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin s => s.SiteGuid, sourceActivitySiteId.NullIfZero(), t => t.ChannelID, - t => t.ChannelGUID + guid => ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), guid).SingleOrDefault() ); switch (result) { diff --git a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs index 4e107eed..eec8aead 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs @@ -1,10 +1,8 @@ -using CMS.ContactManagement; using CMS.DataEngine; using CMS.DataProtection; using MediatR; -using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -14,7 +12,6 @@ using Migration.Tool.Core.K11.Contexts; using Migration.Tool.K11; using Migration.Tool.K11.Models; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.K11.Handlers; diff --git a/Migration.Tool.Core.K11/Handlers/MigrateUsersCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateUsersCommandHandler.cs index 5eb1f71d..2be8b4b5 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateUsersCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateUsersCommandHandler.cs @@ -231,7 +231,7 @@ private async Task MigrateUserRole(int k11RoleId) if (!primaryKeyMappingContext.TryRequireMapFromSource(u => u.RoleId, k11RoleId, out int xbkRoleId)) { var handbookRef = HandbookReferences - .MissingRequiredDependency(nameof(UserRoleInfo.RoleID), k11UserRole.RoleId) + .MissingRequiredDependency(nameof(UserRoleInfo.RoleID), k11UserRole.RoleId) .NeedsManualAction(); protocol.Append(handbookRef); diff --git a/Migration.Tool.Core.K11/Helpers/Printer.cs b/Migration.Tool.Core.K11/Helpers/Printer.cs index a830717a..b41e4819 100644 --- a/Migration.Tool.Core.K11/Helpers/Printer.cs +++ b/Migration.Tool.Core.K11/Helpers/Printer.cs @@ -1,10 +1,12 @@ +using CMS.ContactManagement; using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; using CMS.Membership; using CMS.Modules; - +using CMS.OnlineForms; using Migration.Tool.Common.Helpers; using Migration.Tool.Common.Services; using Migration.Tool.K11.Models; @@ -19,15 +21,15 @@ public static string PrintKxpModelInfo(T model) return model switch { - KXP.Models.MediaLibrary mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGuid)}={mediaLibrary.LibraryGuid}", - KXP.Models.MediaFile mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGuid)}={mediaFile.FileGuid}", - KXP.Models.CmsRole role => $"{currentTypeName}: {nameof(role.RoleGuid)}={role.RoleGuid}, {nameof(role.RoleName)}={role.RoleName}", - KXP.Models.CmsUser user => $"{currentTypeName}: {nameof(user.UserGuid)}={user.UserGuid}, {nameof(user.UserName)}={user.UserName}", - KXP.Models.CmsResource resource => $"{currentTypeName}: {nameof(resource.ResourceGuid)}={resource.ResourceGuid}, {nameof(resource.ResourceName)}={resource.ResourceName}", - KXP.Models.CmsSettingsCategory settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", - KXP.Models.CmsSettingsKey settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGuid)}={settingsKey.KeyGuid}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", - KXP.Models.CmsForm form => $"{currentTypeName}: {nameof(form.FormGuid)}={form.FormGuid}, {nameof(form.FormName)}={form.FormName}", - KXP.Models.OmContactGroup omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGuid)}={omContactGroup.ContactGroupGuid}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", + MediaLibraryInfo mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGUID)}={mediaLibrary.LibraryGUID}", + MediaFileInfo mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGUID)}={mediaFile.FileGUID}", + RoleInfo role => $"{currentTypeName}: {nameof(role.RoleGUID)}={role.RoleGUID}, {nameof(role.RoleName)}={role.RoleName}", + UserInfo user => $"{currentTypeName}: {nameof(user.UserGUID)}={user.UserGUID}, {nameof(user.UserName)}={user.UserName}", + ResourceInfo resource => $"{currentTypeName}: {nameof(resource.ResourceGUID)}={resource.ResourceGUID}, {nameof(resource.ResourceName)}={resource.ResourceName}", + SettingsCategoryInfo settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", + SettingsKeyInfo settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGUID)}={settingsKey.KeyGUID}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", + BizFormInfo form => $"{currentTypeName}: {nameof(form.FormGUID)}={form.FormGUID}, {nameof(form.FormName)}={form.FormName}", + ContactGroupInfo omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGUID)}={omContactGroup.ContactGroupGUID}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", null => $"{currentTypeName}: ", _ => $"TODO: {typeof(T).FullName}" @@ -61,12 +63,11 @@ string FormatModel(string inner) => printType RoleInfo item => FormatModel($"ID={item.RoleID}, Guid={item.RoleGUID} Name={item.RoleName}"), MemberInfo item => FormatModel($"ID={item.MemberID}, Guid={item.MemberGuid} Name={item.MemberName}"), - KXP.Models.CmsForm item => FormatModel($"ID={item.FormId}, GUID={item.FormGuid}, Name={item.FormName}"), - KXP.Models.CmsUser item => FormatModel($"ID={item.UserId}, GUID={item.UserGuid}, Name={item.UserName}"), - KXP.Models.CmsConsent item => FormatModel($"ID={item.ConsentId}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), - KXP.Models.CmsConsentArchive item => FormatModel($"ID={item.ConsentArchiveId}, GUID={item.ConsentArchiveGuid}"), - KXP.Models.CmsConsentAgreement item => FormatModel($"ID={item.ConsentAgreementId}, GUID={item.ConsentAgreementGuid}"), - KXP.Models.CmsSettingsKey item => FormatModel($"ID={item.KeyId}, GUID={item.KeyGuid}, Name={item.KeyName}"), + BizFormInfo item => FormatModel($"ID={item.FormID}, GUID={item.FormGUID}, Name={item.FormName}"), + ConsentInfo item => FormatModel($"ID={item.ConsentID}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), + ConsentArchiveInfo item => FormatModel($"ID={item.ConsentArchiveID}, GUID={item.ConsentArchiveGuid}"), + ConsentAgreementInfo item => FormatModel($"ID={item.ConsentAgreementID}, GUID={item.ConsentAgreementGuid}"), + SettingsKeyInfo item => FormatModel($"ID={item.KeyID}, GUID={item.KeyGUID}, Name={item.KeyName}"), CmsRole item => FormatModel($"ID={item.RoleId}, GUID={item.RoleGuid}, Name={item.RoleName}, SiteId={item.SiteId}"), CmsAttachment item => FormatModel($"ID={item.AttachmentId}, GUID={item.AttachmentGuid}, Name={item.AttachmentName}"), diff --git a/Migration.Tool.Core.K11/K11CoreDiExtensions.cs b/Migration.Tool.Core.K11/K11CoreDiExtensions.cs index 987cdb80..151d833e 100644 --- a/Migration.Tool.Core.K11/K11CoreDiExtensions.cs +++ b/Migration.Tool.Core.K11/K11CoreDiExtensions.cs @@ -1,3 +1,4 @@ +using CMS.ContactManagement; using CMS.DataEngine; using CMS.DataProtection; using CMS.FormEngine; @@ -53,13 +54,12 @@ public static IServiceCollection UseK11ToolCore(this IServiceCollection services services.AddTransient, CmsConsentArchiveMapper>(); services.AddTransient, AlternativeFormMapper>(); services.AddTransient, RoleInfoMapper>(); - services.AddTransient, CmsSettingsCategoryMapper>(); services.AddTransient, CmsSettingsKeyMapper>(); services.AddTransient, UserInfoMapper>(); services.AddTransient, MemberInfoMapper>(); services.AddTransient, UserRoleInfoMapper>(); - services.AddTransient, OmContactGroupMapper>(); - services.AddTransient, OmContactStatusMapper>(); + services.AddTransient, OmContactGroupMapper>(); + services.AddTransient, OmContactStatusMapper>(); services.AddTransient, CountryInfoMapper>(); services.AddTransient, StateInfoMapper>(); diff --git a/Migration.Tool.Core.K11/Mappers/CmsFormMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsFormMapper.cs deleted file mode 100644 index e3b8e0c1..00000000 --- a/Migration.Tool.Core.K11/Mappers/CmsFormMapper.cs +++ /dev/null @@ -1,83 +0,0 @@ -using CMS.FormEngine; -using CMS.OnlineForms; - -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common; -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.K11.Contexts; -using Migration.Tool.K11.Models; - -namespace Migration.Tool.Core.K11.Mappers; - -public class CmsFormMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) -{ - protected override BizFormInfo? CreateNewInstance(CmsForm source, MappingHelper mappingHelper, AddFailure addFailure) - { - var newBizFormInfo = BizFormInfo.New(); - newBizFormInfo.FormGUID = source.FormGuid; - return newBizFormInfo; - } - - protected override BizFormInfo MapInternal(CmsForm source, BizFormInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.FormDisplayName = source.FormDisplayName; - target.FormName = source.FormName; - target.FormItems = source.FormItems; - target.FormReportFields = source.FormReportFields; - target.FormSubmitButtonText = source.FormSubmitButtonText; - target.FormAccess = source.FormAccess.AsEnum(); - target.FormSubmitButtonImage = source.FormSubmitButtonImage; - target.FormLastModified = source.FormLastModified; - target.FormLogActivity = source.FormLogActivity.UseKenticoDefault(); - // target.FormBuilderLayout = source.FormBuilderLayout; - - if (mappingHelper.TranslateRequiredId(c => c.ClassId, source.FormClassId, out int formClassId)) - { - target.FormClassID = formClassId; - } - - return target; - } -} - -public class CmsFormMapperEf(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : EntityMapperBase(logger, pkContext, protocol) -{ - protected override KXP.Models.CmsForm? CreateNewInstance(CmsForm source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override KXP.Models.CmsForm MapInternal(CmsForm source, KXP.Models.CmsForm target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.FormDisplayName = source.FormDisplayName; - target.FormName = source.FormName; - // target.FormSendToEmail = source.FormSendToEmail; - // target.FormSendFromEmail = source.FormSendFromEmail; - // target.FormEmailSubject = source.FormEmailSubject; - // target.FormEmailTemplate = source.FormEmailTemplate; - // target.FormEmailAttachUploadedDocs = source.FormEmailAttachUploadedDocs; - target.FormItems = source.FormItems; - target.FormReportFields = source.FormReportFields; - target.FormSubmitButtonText = source.FormSubmitButtonText; - // target.FormConfirmationEmailField = source.FormConfirmationEmailField; - // target.FormConfirmationTemplate = source.FormConfirmationTemplate; - // target.FormConfirmationSendFromEmail = source.FormConfirmationSendFromEmail; - // target.FormConfirmationEmailSubject = source.FormConfirmationEmailSubject; - target.FormAccess = source.FormAccess; - target.FormSubmitButtonImage = source.FormSubmitButtonImage; - target.FormGuid = source.FormGuid; - target.FormLastModified = source.FormLastModified; - target.FormLogActivity = source.FormLogActivity ?? false; - // target.FormBuilderLayout = source.FormBuilderLayout; - - if (mappingHelper.TranslateRequiredId(c => c.ClassId, source.FormClassId, out int classId)) - { - target.FormClassId = classId; - } - - return target; - } -} diff --git a/Migration.Tool.Core.K11/Mappers/CmsSettingsCategoryMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsSettingsCategoryMapper.cs deleted file mode 100644 index 30d253c3..00000000 --- a/Migration.Tool.Core.K11/Mappers/CmsSettingsCategoryMapper.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.K11.Contexts; -using Migration.Tool.K11.Models; - -namespace Migration.Tool.Core.K11.Mappers; - -public class CmsSettingsCategoryMapper( - ILogger logger, - PrimaryKeyMappingContext pkContext, - IProtocol protocol, - IEntityMapper cmsResourceMapper) - : EntityMapperBase(logger, pkContext, protocol) -{ - protected override KXP.Models.CmsSettingsCategory? CreateNewInstance(CmsSettingsCategory source, MappingHelper mappingHelper, - AddFailure addFailure) => new(); - - - protected override KXP.Models.CmsSettingsCategory MapInternal(CmsSettingsCategory source, KXP.Models.CmsSettingsCategory target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - // no category guid to match on... - if (newInstance) - { - target.CategoryOrder = source.CategoryOrder; - target.CategoryName = source.CategoryName; - target.CategoryDisplayName = source.CategoryDisplayName; - target.CategoryIdpath = source.CategoryIdpath; - target.CategoryLevel = source.CategoryLevel; - target.CategoryChildCount = source.CategoryChildCount; - target.CategoryIconPath = source.CategoryIconPath; - target.CategoryIsGroup = source.CategoryIsGroup; - target.CategoryIsCustom = source.CategoryIsCustom; - } - - if (source.CategoryResource != null) - { - if (target.CategoryResource != null && source.CategoryResourceId != null && target.CategoryResourceId != null) - { - // skip if target is present - logger.LogTrace("Skipping category resource '{ResourceGuid}', already present in target instance", target.CategoryResource.ResourceGuid); - pkContext.SetMapping(r => r.ResourceId, source.CategoryResourceId.Value, target.CategoryResourceId.Value); - } - else - { - switch (cmsResourceMapper.Map(source.CategoryResource, target.CategoryResource)) - { - case { Success: true } result: - { - target.CategoryResource = result.Item; - break; - } - case { Success: false } result: - { - addFailure(new MapperResultFailure(result.HandbookReference)); - break; - } - - default: - break; - } - } - } - else if (mappingHelper.TranslateIdAllowNulls(r => r.ResourceId, source.CategoryResourceId, out int? categoryResourceId)) - { - target.CategoryResourceId = categoryResourceId; - } - - if (source.CategoryParent != null) - { - switch (Map(source.CategoryParent, target.CategoryParent)) - { - case { Success: true } result: - { - target.CategoryParent = result.Item; - break; - } - case { Success: false } result: - { - addFailure(new MapperResultFailure(result.HandbookReference)); - break; - } - - default: - break; - } - } - else if (mappingHelper.TranslateIdAllowNulls(c => c.CategoryId, source.CategoryParentId, out int? categoryParentId)) - { - target.CategoryParentId = categoryParentId; - } - - return target; - } -} diff --git a/Migration.Tool.Core.K11/Mappers/CmsUserMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsUserMapper.cs deleted file mode 100644 index 62b9b783..00000000 --- a/Migration.Tool.Core.K11/Mappers/CmsUserMapper.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.K11.Contexts; -using Migration.Tool.K11.Models; - -namespace Migration.Tool.Core.K11.Mappers; - -public class CmsUserMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) -{ - protected override KXP.Models.CmsUser CreateNewInstance(CmsUser tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override KXP.Models.CmsUser MapInternal(CmsUser source, KXP.Models.CmsUser target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - if (!newInstance && source.UserGuid != target.UserGuid) - { - // assertion failed - logger.LogTrace("Assertion failed, entity key mismatch"); - throw new InvalidOperationException("Assertion failed, entity key mismatch."); - } - - target.UserName = source.UserName; - target.FirstName = source.FirstName; - target.LastName = source.LastName; - target.Email = source.Email; - target.UserPassword = source.UserPassword; - target.UserEnabled = source.UserEnabled; - target.UserCreated = source.UserCreated; - target.LastLogon = source.LastLogon; - target.UserGuid = source.UserGuid; - target.UserLastModified = source.UserLastModified; - target.UserSecurityStamp = source.UserSecurityStamp; - target.UserAdministrationAccess = source.UserPrivilegeLevel == 3; - target.UserIsPendingRegistration = false; - target.UserPasswordLastChanged = null; - target.UserRegistrationLinkExpiration = DateTime.Now.AddDays(365); - - foreach (var sourceCmsUserRole in source.CmsUserRoles) - { - if (mappingHelper.TranslateRequiredId(r => r.RoleId, sourceCmsUserRole.RoleId, out int targetRoleId)) - { - if (target.CmsUserRoles.All(x => x.RoleId != targetRoleId)) - { - target.CmsUserRoles.Add(new KXP.Models.CmsUserRole { RoleId = targetRoleId, User = target }); - } - } - } - - return target; - } -} diff --git a/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs b/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs index a6af5473..d2d986d5 100644 --- a/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs @@ -1,3 +1,4 @@ +using CMS.ContactManagement; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; @@ -11,21 +12,38 @@ public class OmContactGroupMapper( ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) + : EntityMapperBase(logger, primaryKeyMappingContext, protocol) { - protected override KXP.Models.OmContactGroup? CreateNewInstance(OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ContactGroupInfo? CreateNewInstance(OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override KXP.Models.OmContactGroup MapInternal(OmContactGroup source, KXP.Models.OmContactGroup target, bool newInstance, + protected override ContactGroupInfo MapInternal(OmContactGroup source, ContactGroupInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { + T RequireValue(string propertyName, Nullable value, T defaultValue) where T : struct + { + if (value.HasValue) + { + return value.Value; + } + else + { + addFailure(new MapperResultFailure( + HandbookReferences.InvalidSourceData() + .WithMessage("Required property value is null") + .WithId(nameof(source.ContactGroupId), source.ContactGroupId) + .WithData(new { MissingProperty = propertyName }))); + return defaultValue; + } + } + target.ContactGroupName = source.ContactGroupName; target.ContactGroupDisplayName = source.ContactGroupDisplayName; target.ContactGroupDescription = source.ContactGroupDescription; target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; - target.ContactGroupEnabled = source.ContactGroupEnabled; - target.ContactGroupLastModified = source.ContactGroupLastModified; - target.ContactGroupGuid = source.ContactGroupGuid; - target.ContactGroupStatus = source.ContactGroupStatus; + target.ContactGroupEnabled = RequireValue(nameof(source.ContactGroupEnabled), source.ContactGroupEnabled, false); + target.ContactGroupLastModified = RequireValue(nameof(source.ContactGroupLastModified), source.ContactGroupLastModified, DateTime.MinValue); + target.ContactGroupGUID = RequireValue(nameof(source.ContactGroupGuid), source.ContactGroupGuid, Guid.Empty); + target.ContactGroupStatus = (ContactGroupStatusEnum)RequireValue(nameof(source.ContactGroupStatus), source.ContactGroupStatus, 0); return target; } diff --git a/Migration.Tool.Core.K11/Mappers/OmContactStatusMapper.cs b/Migration.Tool.Core.K11/Mappers/OmContactStatusMapper.cs index 19bf2c96..ae2075ca 100644 --- a/Migration.Tool.Core.K11/Mappers/OmContactStatusMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/OmContactStatusMapper.cs @@ -1,3 +1,4 @@ +using CMS.ContactManagement; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; @@ -11,12 +12,12 @@ public class OmContactStatusMapper( ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) - : EntityMapperBase(logger, primaryKeyMappingContext, protocol) + : EntityMapperBase(logger, primaryKeyMappingContext, protocol) { - protected override KXP.Models.OmContactStatus? CreateNewInstance(OmContactStatus tSourceEntity, MappingHelper mappingHelper, + protected override ContactStatusInfo? CreateNewInstance(OmContactStatus tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override KXP.Models.OmContactStatus MapInternal(OmContactStatus source, KXP.Models.OmContactStatus target, bool newInstance, + protected override ContactStatusInfo MapInternal(OmContactStatus source, ContactStatusInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ContactStatusName = source.ContactStatusName; diff --git a/Migration.Tool.Core.K11/Migration.Tool.Core.K11.csproj b/Migration.Tool.Core.K11/Migration.Tool.Core.K11.csproj index db4305e0..391daa41 100644 --- a/Migration.Tool.Core.K11/Migration.Tool.Core.K11.csproj +++ b/Migration.Tool.Core.K11/Migration.Tool.Core.K11.csproj @@ -4,7 +4,6 @@ - diff --git a/Migration.Tool.Core.K11/Services/KeyLocatorService.cs b/Migration.Tool.Core.K11/Services/KeyLocatorService.cs index a621a42c..533e6a51 100644 --- a/Migration.Tool.Core.K11/Services/KeyLocatorService.cs +++ b/Migration.Tool.Core.K11/Services/KeyLocatorService.cs @@ -1,30 +1,40 @@ using System.Linq.Expressions; using System.Runtime.CompilerServices; - +using CMS.ContactManagement; +using CMS.DataEngine; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.K11; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.K11.Services; public class KeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory k11ContextFactory) { + /// + /// Finds key of target matched to source by equal GUIDs + /// + /// Type of source instance + /// Type of target instance + /// Type of target key + /// Expression that selects key from TSource instance + /// Expression that selects key from TTarget instance + /// Expression that selects GUID from TSource instance + /// Func that returns TTarget instance uniquely identified by its GUID. In case of multiple GUIDs in target dataset, it must return null + /// Source key to begin with + /// Matched target key + /// public bool TryLocate( Expression> sourceKeySelector, - Expression> targetKeySelector, + Func targetKeySelector, Expression> sourceGuidSelector, - Expression> targetGuidSelector, + Func targetByGuidProvider, object? sourceKey, out TTargetKey targetId ) where TSource : class where TTarget : class { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var k11Context = k11ContextFactory.CreateDbContext(); - var sourceType = typeof(TSource); Unsafe.SkipInit(out targetId); @@ -42,24 +52,16 @@ public bool TryLocate( var sourcePredicate = Expression.Lambda>(sourceEquals, sourceKeySelector.Parameters[0]); var k11Guid = k11Context.Set().Where(sourcePredicate).Select(sourceGuidSelector).Single(); - var param = Expression.Parameter(typeof(TTarget), "t"); - var member = targetGuidSelector.Body as MemberExpression ?? throw new InvalidOperationException($"Expression SHALL NOT be other than member expression, expression: {targetGuidSelector}"); - var targetEquals = Expression.Equal( - Expression.MakeMemberAccess(param, member.Member), - Expression.Constant(k11Guid, typeof(Guid)) - ); - var targetPredicate = Expression.Lambda>(targetEquals, param); + var target = targetByGuidProvider(k11Guid); + if (target is null) + { + logger.LogWarning("Mapping {SourceFullType} primary key: {SourceId} failed, GUID {TargetGUID} not present in target instance", sourceType.FullName, sourceKey, k11Guid); + return false; + } - var query = kxpContext.Set().Where(targetPredicate); - var selector = Expression.Lambda>(targetKeySelector.Body, targetKeySelector.Parameters[0]); - targetId = query.Select(selector).Single(); + targetId = targetKeySelector(target); return true; } - catch (InvalidOperationException ioex) - { - logger.LogWarning("Mapping {SourceFullType} primary key: {SourceId} failed, {Message}", sourceType.FullName, sourceKey, ioex.Message); - return false; - } finally { if (!targetId?.Equals(default) ?? false) diff --git a/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs b/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs index b593263e..bdc8516d 100644 --- a/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs +++ b/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs @@ -1,24 +1,27 @@ using System.Linq.Expressions; - +using CMS.ContactManagement; +using CMS.ContentEngine; +using CMS.DataEngine; +using CMS.Globalization; +using CMS.Membership; +using CMS.Modules; +using CMS.OnlineForms; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; using Migration.Tool.K11; using Migration.Tool.K11.Models; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.K11.Services; public class PrimaryKeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory k11ContextFactory) : IPrimaryKeyLocatorService { public IEnumerable SelectAll(Expression> keyNameSelector) { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var k11Context = k11ContextFactory.CreateDbContext(); var sourceType = typeof(T); @@ -29,12 +32,12 @@ public IEnumerable SelectAll(Expression new { x.UserId, x.UserGuid, x.UserName }).ToList(); - var targetUsers = kxpContext.CmsUsers.Select(x => new { x.UserId, x.UserName, x.UserGuid }).ToList(); + var targetUsers = UserInfo.Provider.Get().Select(x => new { x.UserID, x.UserName, x.UserGUID }).ToList(); var result = sourceUsers.Join(targetUsers, a => new CmsUserKey(a.UserGuid, a.UserName), - b => new CmsUserKey(b.UserGuid, b.UserName), - (a, b) => new SourceTargetKeyMapping(a.UserId, b.UserId), + b => new CmsUserKey(b.UserGUID, b.UserName), + (a, b) => new SourceTargetKeyMapping(a.UserId, b.UserID), new KeyEqualityComparerWithLambda((ak, bk) => (ak?.UserGuid == bk?.UserGuid || ak?.UserName == bk?.UserName) && ak != null && bk != null) ); @@ -51,14 +54,14 @@ public IEnumerable SelectAll(Expression c.ContactCreated) .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); - var target = kxpContext.OmContacts - .OrderBy(c => c.ContactCreated) - .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); + var target = ContactInfo.Provider.Get() + .OrderBy(nameof(ContactInfo.ContactCreated)) + .Select(x => new { x.ContactID, x.ContactGUID }).ToList(); var result = source.Join(target, a => a.ContactGuid, - b => b.ContactGuid, - (a, b) => new SourceTargetKeyMapping(a.ContactId, b.ContactId) + b => b.ContactGUID, + (a, b) => new SourceTargetKeyMapping(a.ContactId, b.ContactID) ); foreach (var resultingMapping in result) @@ -72,12 +75,12 @@ public IEnumerable SelectAll(Expression new { x.StateId, x.StateName }).ToList(); - var target = kxpContext.CmsStates.Select(x => new { x.StateId, x.StateName }).ToList(); + var target = StateInfo.Provider.Get().Select(x => new { x.StateID, x.StateName }).ToList(); var result = source.Join(target, a => a.StateName, b => b.StateName, - (a, b) => new SourceTargetKeyMapping(a.StateId, b.StateId) + (a, b) => new SourceTargetKeyMapping(a.StateId, b.StateID) ); foreach (var resultingMapping in result) @@ -91,12 +94,12 @@ public IEnumerable SelectAll(Expression new { x.CountryId, x.CountryName }).ToList(); - var target = kxpContext.CmsCountries.Select(x => new { x.CountryId, x.CountryName }).ToList(); + var target = CountryInfo.Provider.Get().Select(x => new { x.CountryID, x.CountryName }).ToList(); var result = source.Join(target, a => a.CountryName, b => b.CountryName, - (a, b) => new SourceTargetKeyMapping(a.CountryId, b.CountryId) + (a, b) => new SourceTargetKeyMapping(a.CountryId, b.CountryID) ); foreach (var resultingMapping in result) @@ -113,8 +116,7 @@ public IEnumerable SelectAll(Expression(Expression> keyNameSelector, int sourceId, out int targetId) { - using var kxpContext = kxpContextFactory.CreateDbContext(); - using var KX12Context = k11ContextFactory.CreateDbContext(); + using var kx11Context = k11ContextFactory.CreateDbContext(); var sourceType = typeof(T); targetId = -1; @@ -122,64 +124,64 @@ public bool TryLocate(Expression> keyNameSelector, int source { if (sourceType == typeof(CmsResource)) { - var k11Guid = KX12Context.CmsResources.Where(c => c.ResourceId == sourceId).Select(x => x.ResourceGuid).Single(); - targetId = kxpContext.CmsResources.Where(x => x.ResourceGuid == k11Guid).Select(x => x.ResourceId).Single(); + var k11Guid = kx11Context.CmsResources.Where(c => c.ResourceId == sourceId).Select(x => x.ResourceGuid).Single(); + targetId = ResourceInfo.Provider.Get().WhereEquals(nameof(ResourceInfo.ResourceGUID), k11Guid).Select(x => x.ResourceID).Single(); return true; } if (sourceType == typeof(Tool.K11.Models.CmsClass)) { - var k11Guid = KX12Context.CmsClasses.Where(c => c.ClassId == sourceId).Select(x => x.ClassGuid).Single(); - targetId = kxpContext.CmsClasses.Where(x => x.ClassGuid == k11Guid).Select(x => x.ClassId).Single(); + var k11Guid = kx11Context.CmsClasses.Where(c => c.ClassId == sourceId).Select(x => x.ClassGuid).Single(); + targetId = DataClassInfoProvider.GetClasses().Where(x => x.ClassGUID == k11Guid).Select(x => x.ClassID).Single(); return true; } if (sourceType == typeof(CmsUser)) { - var k11User = KX12Context.CmsUsers.Where(c => c.UserId == sourceId).Select(x => new { x.UserGuid, x.UserName }).Single(); - targetId = kxpContext.CmsUsers.Where(x => x.UserGuid == k11User.UserGuid || x.UserName == k11User.UserName).Select(x => x.UserId).Single(); + var k11User = kx11Context.CmsUsers.Where(c => c.UserId == sourceId).Select(x => new { x.UserGuid, x.UserName }).Single(); + targetId = UserInfo.Provider.Get().WhereEquals(nameof(UserInfo.UserGUID), k11User.UserGuid).Or().WhereEquals(nameof(UserInfo.UserName), k11User.UserName).Select(x => x.UserID).Single(); return true; } if (sourceType == typeof(CmsRole)) { - var k11Role = KX12Context.CmsRoles.Where(c => c.RoleId == sourceId).Select(x => new { x.RoleGuid }).Single(); - targetId = kxpContext.CmsRoles.Where(x => x.RoleGuid == k11Role.RoleGuid).Select(x => x.RoleId).Single(); + var k11Role = kx11Context.CmsRoles.Where(c => c.RoleId == sourceId).Select(x => new { x.RoleGuid }).Single(); + targetId = RoleInfo.Provider.Get().WhereEquals(nameof(RoleInfo.RoleGUID), k11Role.RoleGuid).Select(x => x.RoleID).Single(); return true; } if (sourceType == typeof(CmsSite)) { - var k11Guid = KX12Context.CmsSites.Where(c => c.SiteId == sourceId).Select(x => x.SiteGuid).Single(); - targetId = kxpContext.CmsChannels.Where(x => x.ChannelGuid == k11Guid).Select(x => x.ChannelId).Single(); + var k11Guid = kx11Context.CmsSites.Where(c => c.SiteId == sourceId).Select(x => x.SiteGuid).Single(); + targetId = ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), k11Guid).Select(x => x.ChannelID).Single(); return true; } if (sourceType == typeof(CmsState)) { - string k11CodeName = KX12Context.CmsStates.Where(c => c.StateId == sourceId).Select(x => x.StateName).Single(); - targetId = kxpContext.CmsStates.Where(x => x.StateName == k11CodeName).Select(x => x.StateId).Single(); + string k11CodeName = kx11Context.CmsStates.Where(c => c.StateId == sourceId).Select(x => x.StateName).Single(); + targetId = StateInfo.Provider.Get().WhereEquals(nameof(StateInfo.StateName), k11CodeName).Select(x => x.StateID).Single(); return true; } if (sourceType == typeof(CmsCountry)) { - string k11CodeName = KX12Context.CmsCountries.Where(c => c.CountryId == sourceId).Select(x => x.CountryName).Single(); - targetId = kxpContext.CmsCountries.Where(x => x.CountryName == k11CodeName).Select(x => x.CountryId).Single(); + string k11CodeName = kx11Context.CmsCountries.Where(c => c.CountryId == sourceId).Select(x => x.CountryName).Single(); + targetId = CountryInfo.Provider.Get().WhereEquals(nameof(CountryInfo.CountryName), k11CodeName).Select(x => x.CountryID).Single(); return true; } if (sourceType == typeof(OmContactStatus)) { - string k11Guid = KX12Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); - targetId = kxpContext.OmContactStatuses.Where(x => x.ContactStatusName == k11Guid).Select(x => x.ContactStatusId).Single(); + string k11Guid = kx11Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); + targetId = ContactStatusInfo.Provider.Get().WhereEquals(nameof(ContactStatusInfo.ContactStatusName), k11Guid).Select(x => x.ContactStatusID).Single(); return true; } if (sourceType == typeof(OmContact)) { - var k11Guid = KX12Context.OmContacts.Where(c => c.ContactId == sourceId).Select(x => x.ContactGuid).Single(); - targetId = kxpContext.OmContacts.Where(x => x.ContactGuid == k11Guid).Select(x => x.ContactId).Single(); + var k11Guid = kx11Context.OmContacts.Where(c => c.ContactId == sourceId).Select(x => x.ContactGuid).Single(); + targetId = ContactInfo.Provider.Get().WhereEquals(nameof(ContactInfo.ContactGUID), k11Guid).Select(x => x.ContactID).Single(); return true; } } From 5ea5fb59a1e3de8acb9fd37efbea16254986394c Mon Sep 17 00:00:00 2001 From: akfakmot Date: Wed, 13 Nov 2024 17:39:13 +0100 Subject: [PATCH 04/10] Fix formatting Chore: Fix formatting --- .../Handlers/MigrateDataProtectionCommandHandler.cs | 2 +- Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs | 2 +- Migration.Tool.Core.K11/Services/KeyLocatorService.cs | 2 -- Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs index eec8aead..4b8ab216 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs @@ -121,7 +121,7 @@ private async Task MigrateConsentAgreement(CancellationToken canc { (var agreementInfo, bool newInstance) = result; ArgumentNullException.ThrowIfNull(agreementInfo, nameof(agreementInfo)); - + if (newInstance) { consentAgreementNews.Add(agreementInfo); diff --git a/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs b/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs index d2d986d5..90b7432f 100644 --- a/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/OmContactGroupMapper.cs @@ -19,7 +19,7 @@ public class OmContactGroupMapper( protected override ContactGroupInfo MapInternal(OmContactGroup source, ContactGroupInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { - T RequireValue(string propertyName, Nullable value, T defaultValue) where T : struct + T RequireValue(string propertyName, T? value, T defaultValue) where T : struct { if (value.HasValue) { diff --git a/Migration.Tool.Core.K11/Services/KeyLocatorService.cs b/Migration.Tool.Core.K11/Services/KeyLocatorService.cs index 533e6a51..7b535157 100644 --- a/Migration.Tool.Core.K11/Services/KeyLocatorService.cs +++ b/Migration.Tool.Core.K11/Services/KeyLocatorService.cs @@ -1,7 +1,5 @@ using System.Linq.Expressions; using System.Runtime.CompilerServices; -using CMS.ContactManagement; -using CMS.DataEngine; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; diff --git a/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs b/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs index bdc8516d..3acb83a6 100644 --- a/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs +++ b/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs @@ -5,7 +5,6 @@ using CMS.Globalization; using CMS.Membership; using CMS.Modules; -using CMS.OnlineForms; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; From 3324963541245a91364482309384d285d79d881d Mon Sep 17 00:00:00 2001 From: akfakmot Date: Wed, 13 Nov 2024 19:14:43 +0100 Subject: [PATCH 05/10] Remove dependencies on Migrate.Tool.KXP from Migration.Tool.Source & Migration.Tool.Common Refactor: Remove dependencies on Migrate.Tool.KXP from Migration.Tool.Source & Migration.Tool.Common --- .../Handlers/MigrateFormsCommandHandler.cs | 43 ++---- .../MigratePageTypesCommandHandler.cs | 9 +- .../Handlers/MigratePagesCommandHandler.cs | 3 +- KVA/Migration.Tool.Source/Helpers/Printer.cs | 33 ++-- .../KsCoreDiExtensions.cs | 2 - .../Mappers/CmsFormMapper.cs | 67 +------- .../Migration.Tool.Source.csproj | 1 - .../AttachmentMigratorToMediaLibrary.cs | 12 +- .../Services/MediaFileMigrator.cs | 145 ++++++++---------- .../Services/PrimaryKeyLocatorService.cs | 54 ++++--- Migration.Tool.Common/EntityConfiguration.cs | 11 +- .../Helpers/ReflectionHelper.cs | 6 + .../Migration.Tool.Common.csproj | 4 +- .../Services/PrimaryKeyLocatorService.cs | 4 +- 14 files changed, 147 insertions(+), 247 deletions(-) diff --git a/KVA/Migration.Tool.Source/Handlers/MigrateFormsCommandHandler.cs b/KVA/Migration.Tool.Source/Handlers/MigrateFormsCommandHandler.cs index 0dc8c68b..239657aa 100644 --- a/KVA/Migration.Tool.Source/Handlers/MigrateFormsCommandHandler.cs +++ b/KVA/Migration.Tool.Source/Handlers/MigrateFormsCommandHandler.cs @@ -4,11 +4,10 @@ using CMS.Base; using CMS.DataEngine; - +using CMS.OnlineForms; using MediatR; using Microsoft.Data.SqlClient; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; @@ -16,8 +15,6 @@ using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Common.Services.BulkCopy; using Migration.Tool.KXP.Api; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Contexts; using Migration.Tool.Source.Model; @@ -25,9 +22,8 @@ namespace Migration.Tool.Source.Handlers; public class MigrateFormsCommandHandler( ILogger logger, - IDbContextFactory kxpContextFactory, IEntityMapper dataClassMapper, - IEntityMapper cmsFormMapper, + IEntityMapper cmsFormMapper, KxpClassFacade kxpClassFacade, BulkDataCopyService bulkDataCopyService, PrimaryKeyMappingContext primaryKeyMappingContext, @@ -35,12 +31,8 @@ public class MigrateFormsCommandHandler( ModelFacade modelFacade, ToolConfiguration configuration ) - : IRequestHandler, IDisposable + : IRequestHandler { - private KxpContext kxpContext = kxpContextFactory.CreateDbContext(); - - public void Dispose() => kxpContext.Dispose(); - public async Task Handle(MigrateFormsCommand request, CancellationToken cancellationToken) { var cmsClassForms = modelFacade.Select("ClassIsForm = 1", "ClassID"); @@ -63,7 +55,7 @@ public async Task Handle(MigrateFormsCommand request, Cancellatio { protocol.FetchedSource(ksCmsForm); - var kxoCmsForm = kxpContext.CmsForms.FirstOrDefault(f => f.FormGuid == ksCmsForm.FormGUID); + var kxoCmsForm = BizFormInfo.Provider.Get(ksCmsForm.FormGUID); protocol.FetchedTarget(kxoCmsForm); @@ -75,33 +67,22 @@ public async Task Handle(MigrateFormsCommand request, Cancellatio (var cmsForm, bool newInstance) = result; ArgumentNullException.ThrowIfNull(cmsForm, nameof(cmsForm)); + try { - if (newInstance) - { - kxpContext.CmsForms.Add(cmsForm); - } - else - { - kxpContext.CmsForms.Update(cmsForm); - } - - await kxpContext.SaveChangesAsync(cancellationToken); + BizFormInfo.Provider.Set(cmsForm!); logger.LogEntitySetAction(newInstance, cmsForm); - primaryKeyMappingContext.SetMapping( - r => r.FormId, + primaryKeyMappingContext.SetMapping( + r => r.FormID, ksClass.ClassID, - cmsForm.FormId + cmsForm.FormID ); } catch (Exception ex) { - await kxpContext.DisposeAsync(); // reset context errors - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - protocol.Append(HandbookReferences - .ErrorCreatingTargetInstance(ex) + .ErrorCreatingTargetInstance(ex) .NeedsManualAction() .WithIdentityPrint(cmsForm) ); @@ -168,8 +149,8 @@ private bool MapAndSaveUsingKxoApi(ICmsClass ksClass, DataClassInfo kxoDataClass protocol.Success(ksClass, dataClassInfo, mapped); logger.LogEntitySetAction(newInstance, dataClassInfo); - primaryKeyMappingContext.SetMapping( - r => r.ClassId, + primaryKeyMappingContext.SetMapping( + r => r.ClassID, ksClass.ClassID, dataClassInfo.ClassID ); diff --git a/KVA/Migration.Tool.Source/Handlers/MigratePageTypesCommandHandler.cs b/KVA/Migration.Tool.Source/Handlers/MigratePageTypesCommandHandler.cs index c791d10b..b1502414 100644 --- a/KVA/Migration.Tool.Source/Handlers/MigratePageTypesCommandHandler.cs +++ b/KVA/Migration.Tool.Source/Handlers/MigratePageTypesCommandHandler.cs @@ -13,7 +13,6 @@ using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.KXP.Api; using Migration.Tool.KXP.Api.Services.CmsClass; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Contexts; using Migration.Tool.Source.Helpers; using Migration.Tool.Source.Mappers; @@ -42,7 +41,7 @@ IEnumerable reusableSchemaBuilders public async Task Handle(MigratePageTypesCommand request, CancellationToken cancellationToken) { - var entityConfiguration = toolConfiguration.EntityConfigurations.GetEntityConfiguration(); + var entityConfiguration = toolConfiguration.EntityConfigurations.GetEntityConfiguration(); using var ksClasses = EnumerableHelper.CreateDeferrableItemWrapper( modelFacade.Select("ClassIsDocumentType=1", "ClassID") @@ -202,7 +201,7 @@ public async Task Handle(MigratePageTypesCommand request, Cancell { logger.LogErrorMissingDependency(ksClass, nameof(ksClass.ClassInheritsFromClassID), ksClass.ClassInheritsFromClassID, typeof(DataClassInfo)); protocol.Append(HandbookReferences - .MissingRequiredDependency(nameof(CmsClass.ClassId), classInheritsFromClassId) + .MissingRequiredDependency(nameof(DataClassInfo.ClassID), classInheritsFromClassId) .NeedsManualAction() ); } @@ -365,8 +364,8 @@ private async Task MigratePageTemplateConfigurations() protocol.Success(ksClass, dataClassInfo, mapped); logger.LogEntitySetAction(newInstance, dataClassInfo); - primaryKeyMappingContext.SetMapping( - r => r.ClassId, + primaryKeyMappingContext.SetMapping( + r => r.ClassID, ksClass.ClassID, dataClassInfo.ClassID ); diff --git a/KVA/Migration.Tool.Source/Handlers/MigratePagesCommandHandler.cs b/KVA/Migration.Tool.Source/Handlers/MigratePagesCommandHandler.cs index aa5608ba..0ca85607 100644 --- a/KVA/Migration.Tool.Source/Handlers/MigratePagesCommandHandler.cs +++ b/KVA/Migration.Tool.Source/Handlers/MigratePagesCommandHandler.cs @@ -19,7 +19,6 @@ using Migration.Tool.Common.Helpers; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Common.Model; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Contexts; using Migration.Tool.Source.Helpers; using Migration.Tool.Source.Mappers; @@ -53,7 +52,7 @@ ClassMappingProvider classMappingProvider public async Task Handle(MigratePagesCommand request, CancellationToken cancellationToken) { - var classEntityConfiguration = toolConfiguration.EntityConfigurations.GetEntityConfiguration(); + var classEntityConfiguration = toolConfiguration.EntityConfigurations.GetEntityConfiguration(); var cultureCodeToLanguageGuid = modelFacade.SelectAll() .ToDictionary(c => c.CultureCode, c => c.CultureGUID, StringComparer.InvariantCultureIgnoreCase); diff --git a/KVA/Migration.Tool.Source/Helpers/Printer.cs b/KVA/Migration.Tool.Source/Helpers/Printer.cs index a7269fe9..954aa0d0 100644 --- a/KVA/Migration.Tool.Source/Helpers/Printer.cs +++ b/KVA/Migration.Tool.Source/Helpers/Printer.cs @@ -1,13 +1,15 @@ +using CMS.ContactManagement; using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; using CMS.Membership; using CMS.Modules; +using CMS.OnlineForms; using CMS.Websites; using Migration.Tool.Common.Helpers; using Migration.Tool.Common.Services; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Model; namespace Migration.Tool.Source.Helpers; @@ -20,15 +22,15 @@ public static string PrintKxpModelInfo(T model) return model switch { - MediaLibrary mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGuid)}={mediaLibrary.LibraryGuid}", - MediaFile mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGuid)}={mediaFile.FileGuid}", - CmsRole role => $"{currentTypeName}: {nameof(role.RoleGuid)}={role.RoleGuid}, {nameof(role.RoleName)}={role.RoleName}", - CmsUser user => $"{currentTypeName}: {nameof(user.UserGuid)}={user.UserGuid}, {nameof(user.UserName)}={user.UserName}", - CmsResource resource => $"{currentTypeName}: {nameof(resource.ResourceGuid)}={resource.ResourceGuid}, {nameof(resource.ResourceName)}={resource.ResourceName}", - CmsSettingsCategory settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", - CmsSettingsKey settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGuid)}={settingsKey.KeyGuid}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", - CmsForm form => $"{currentTypeName}: {nameof(form.FormGuid)}={form.FormGuid}, {nameof(form.FormName)}={form.FormName}", - OmContactGroup omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGuid)}={omContactGroup.ContactGroupGuid}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", + MediaLibraryInfo mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGUID)}={mediaLibrary.LibraryGUID}", + MediaFileInfo mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGUID)}={mediaFile.FileGUID}", + RoleInfo role => $"{currentTypeName}: {nameof(role.RoleGUID)}={role.RoleGUID}, {nameof(role.RoleName)}={role.RoleName}", + UserInfo user => $"{currentTypeName}: {nameof(user.UserGUID)}={user.UserGUID}, {nameof(user.UserName)}={user.UserName}", + ResourceInfo resource => $"{currentTypeName}: {nameof(resource.ResourceGUID)}={resource.ResourceGUID}, {nameof(resource.ResourceName)}={resource.ResourceName}", + SettingsCategoryInfo settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", + SettingsKeyInfo settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGUID)}={settingsKey.KeyGUID}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", + BizFormInfo form => $"{currentTypeName}: {nameof(form.FormGUID)}={form.FormGUID}, {nameof(form.FormName)}={form.FormName}", + ContactGroupInfo omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGUID)}={omContactGroup.ContactGroupGUID}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", null => $"{currentTypeName}: ", _ => $"TODO: {typeof(T).FullName}" @@ -63,12 +65,11 @@ string FormatModel(string inner) => printType MemberInfo item => FormatModel($"ID={item.MemberID}, Guid={item.MemberGuid} Name={item.MemberName}"), WebPageFormerUrlPathInfo item => FormatModel($"ID={item.WebPageFormerUrlPathID}, Guid=N/A Name={item.WebPageFormerUrlPath}"), - CmsForm item => FormatModel($"ID={item.FormId}, GUID={item.FormGuid}, Name={item.FormName}"), - CmsUser item => FormatModel($"ID={item.UserId}, GUID={item.UserGuid}, Name={item.UserName}"), - CmsConsent item => FormatModel($"ID={item.ConsentId}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), - CmsConsentArchive item => FormatModel($"ID={item.ConsentArchiveId}, GUID={item.ConsentArchiveGuid}"), - CmsConsentAgreement item => FormatModel($"ID={item.ConsentAgreementId}, GUID={item.ConsentAgreementGuid}"), - CmsSettingsKey item => FormatModel($"ID={item.KeyId}, GUID={item.KeyGuid}, Name={item.KeyName}"), + BizFormInfo item => FormatModel($"ID={item.FormID}, GUID={item.FormGUID}, Name={item.FormName}"), + ConsentInfo item => FormatModel($"ID={item.ConsentID}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), + ConsentArchiveInfo item => FormatModel($"ID={item.ConsentArchiveID}, GUID={item.ConsentArchiveGuid}"), + ConsentAgreementInfo item => FormatModel($"ID={item.ConsentAgreementID}, GUID={item.ConsentAgreementGuid}"), + SettingsKeyInfo item => FormatModel($"ID={item.KeyID}, GUID={item.KeyGUID}, Name={item.KeyName}"), CmsPageTemplateConfigurationK11 item => FormatModel($"Item not exists in K11 {item}"), CmsPageTemplateConfigurationK12 item => FormatModel($"ID={item.PageTemplateConfigurationID}, GUID={item.PageTemplateConfigurationGUID}, Name={item.PageTemplateConfigurationName}, SiteId={item.PageTemplateConfigurationSiteID}"), diff --git a/KVA/Migration.Tool.Source/KsCoreDiExtensions.cs b/KVA/Migration.Tool.Source/KsCoreDiExtensions.cs index 244bfac3..4df44c23 100644 --- a/KVA/Migration.Tool.Source/KsCoreDiExtensions.cs +++ b/KVA/Migration.Tool.Source/KsCoreDiExtensions.cs @@ -18,7 +18,6 @@ using Migration.Tool.Common.Services; using Migration.Tool.Common.Services.BulkCopy; using Migration.Tool.Common.Services.Ipc; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Auxiliary; using Migration.Tool.Source.Behaviors; using Migration.Tool.Source.Contexts; @@ -94,7 +93,6 @@ public static IServiceCollection UseKsToolCore(this IServiceCollection services, services.AddTransient, CmsAttachmentMapper>(); services.AddTransient, CmsClassMapper>(); services.AddTransient, CmsFormMapper>(); - services.AddTransient, CmsFormMapperEf>(); services.AddTransient, ResourceMapper>(); services.AddTransient, AlternativeFormMapper>(); services.AddTransient, MemberInfoMapper>(); diff --git a/KVA/Migration.Tool.Source/Mappers/CmsFormMapper.cs b/KVA/Migration.Tool.Source/Mappers/CmsFormMapper.cs index 18af8c17..774ea967 100644 --- a/KVA/Migration.Tool.Source/Mappers/CmsFormMapper.cs +++ b/KVA/Migration.Tool.Source/Mappers/CmsFormMapper.cs @@ -6,7 +6,6 @@ using Migration.Tool.Common; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Contexts; using Migration.Tool.Source.Model; @@ -35,6 +34,8 @@ protected override BizFormInfo MapInternal(ICmsForm source, BizFormInfo target, target.FormAccess = source.FormAccess.AsEnum(); target.FormSubmitButtonImage = source.FormSubmitButtonImage; target.FormLastModified = source.FormLastModified; + target.FormGUID = source.FormGUID; + switch (source) { case CmsFormK11 s: @@ -67,67 +68,3 @@ protected override BizFormInfo MapInternal(ICmsForm source, BizFormInfo target, return target; } } - -public class CmsFormMapperEf : EntityMapperBase -{ - public CmsFormMapperEf(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) - { - } - - protected override CmsForm? CreateNewInstance(ICmsForm source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override CmsForm MapInternal(ICmsForm source, CmsForm target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.FormDisplayName = source.FormDisplayName; - target.FormName = source.FormName; - // target.FormSendToEmail = source.FormSendToEmail; - // target.FormSendFromEmail = source.FormSendFromEmail; - // target.FormEmailSubject = source.FormEmailSubject; - // target.FormEmailTemplate = source.FormEmailTemplate; - // target.FormEmailAttachUploadedDocs = source.FormEmailAttachUploadedDocs; - target.FormItems = source.FormItems; - target.FormReportFields = source.FormReportFields; - target.FormSubmitButtonText = source.FormSubmitButtonText; - // target.FormConfirmationEmailField = source.FormConfirmationEmailField; - // target.FormConfirmationTemplate = source.FormConfirmationTemplate; - // target.FormConfirmationSendFromEmail = source.FormConfirmationSendFromEmail; - // target.FormConfirmationEmailSubject = source.FormConfirmationEmailSubject; - target.FormAccess = source.FormAccess; - target.FormSubmitButtonImage = source.FormSubmitButtonImage; - target.FormGuid = source.FormGUID; - target.FormLastModified = source.FormLastModified; - switch (source) - { - case CmsFormK11 s: - { - target.FormLogActivity = s.FormLogActivity.UseKenticoDefault(); - break; - } - case CmsFormK12 s: - { - target.FormLogActivity = s.FormLogActivity.UseKenticoDefault(); - target.FormBuilderLayout = s.FormBuilderLayout; - break; - } - case CmsFormK13 s: - { - target.FormLogActivity = s.FormLogActivity; - target.FormBuilderLayout = s.FormBuilderLayout; - break; - } - - default: - break; - } - - // TODO tk: 2022-05-20 new deduce: target.FormAfterSubmitMode = source.FormAfterSubmitMode; - // TODO tk: 2022-05-20 new deduce: target.FormAfterSubmitRelatedValue = source.FormAfterSubmitRelatedValue; - - if (mappingHelper.TranslateRequiredId(c => c.ClassID, source.FormClassID, out int classId)) - { - target.FormClassId = classId; - } - - return target; - } -} diff --git a/KVA/Migration.Tool.Source/Migration.Tool.Source.csproj b/KVA/Migration.Tool.Source/Migration.Tool.Source.csproj index 9d36a5de..9d355263 100644 --- a/KVA/Migration.Tool.Source/Migration.Tool.Source.csproj +++ b/KVA/Migration.Tool.Source/Migration.Tool.Source.csproj @@ -9,7 +9,6 @@ - diff --git a/KVA/Migration.Tool.Source/Services/AttachmentMigratorToMediaLibrary.cs b/KVA/Migration.Tool.Source/Services/AttachmentMigratorToMediaLibrary.cs index d03c645c..b003ff32 100644 --- a/KVA/Migration.Tool.Source/Services/AttachmentMigratorToMediaLibrary.cs +++ b/KVA/Migration.Tool.Source/Services/AttachmentMigratorToMediaLibrary.cs @@ -5,14 +5,12 @@ using CMS.Helpers; using CMS.MediaLibrary; using Microsoft.Data.SqlClient; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.KXP.Api; using Migration.Tool.KXP.Api.Auxiliary; -using Migration.Tool.KXP.Context; using Migration.Tool.Source.Auxiliary; using Migration.Tool.Source.Mappers; using Migration.Tool.Source.Model; @@ -22,7 +20,6 @@ namespace Migration.Tool.Source.Services; public class AttachmentMigratorToMediaLibrary( ILogger logger, KxpMediaFileFacade mediaFileFacade, - IDbContextFactory kxpContextFactory, IEntityMapper attachmentMapper, IProtocol protocol, ModelFacade modelFacade, @@ -227,11 +224,10 @@ private bool TryEnsureTargetLibraryExists(int targetSiteId, string targetSiteNam { string targetLibraryCodeName = $"AttachmentsForSite{targetSiteName}"; string targetLibraryDisplayName = $"Attachments for site {targetSiteName}"; - using var dbContext = kxpContextFactory.CreateDbContext(); try { targetLibraryId = mediaLibraryIdCache.GetOrAdd((targetLibraryCodeName, targetSiteId), static (arg, context) => MediaLibraryFactory(arg, context), - new MediaLibraryFactoryContext(mediaFileFacade, targetLibraryCodeName, targetLibraryDisplayName, dbContext)); + new MediaLibraryFactoryContext(mediaFileFacade, targetLibraryCodeName, targetLibraryDisplayName)); return true; } @@ -253,7 +249,7 @@ private static int MediaLibraryFactory((string libraryName, int siteId) arg, Med (string libraryName, int siteId) = arg; // TODO tomas.krch: 2023-11-02 libraries now globalized, where do i put conflicting directories? - var tml = context.DbContext.MediaLibraries.SingleOrDefault(ml => ml.LibraryName == libraryName); + var tml = MediaLibraryInfo.Provider.Get().WhereEquals(nameof(MediaLibraryInfo.LibraryName), libraryName).SingleOrDefault(); string libraryDirectory = context.TargetLibraryCodeName; if (!libraryPathValidationRegex.IsMatch(libraryDirectory)) @@ -261,9 +257,9 @@ private static int MediaLibraryFactory((string libraryName, int siteId) arg, Med libraryDirectory = sanitizationRegex.Replace(libraryDirectory, "_"); } - return tml?.LibraryId ?? context.MediaFileFacade + return tml?.LibraryID ?? context.MediaFileFacade .CreateMediaLibrary(siteId, libraryDirectory, "Created by Xperience Migration.Tool", context.TargetLibraryCodeName, context.TargetLibraryDisplayName).LibraryID; } - private record MediaLibraryFactoryContext(KxpMediaFileFacade MediaFileFacade, string TargetLibraryCodeName, string TargetLibraryDisplayName, KxpContext DbContext); + private record MediaLibraryFactoryContext(KxpMediaFileFacade MediaFileFacade, string TargetLibraryCodeName, string TargetLibraryDisplayName); } diff --git a/KVA/Migration.Tool.Source/Services/MediaFileMigrator.cs b/KVA/Migration.Tool.Source/Services/MediaFileMigrator.cs index 2ae055a1..64452916 100644 --- a/KVA/Migration.Tool.Source/Services/MediaFileMigrator.cs +++ b/KVA/Migration.Tool.Source/Services/MediaFileMigrator.cs @@ -2,15 +2,12 @@ using CMS.Base; using CMS.MediaLibrary; using Microsoft.Data.SqlClient; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.KXP.Api; using Migration.Tool.KXP.Api.Auxiliary; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; using Migration.Tool.Source.Auxiliary; using Migration.Tool.Source.Contexts; using Migration.Tool.Source.Handlers; @@ -21,7 +18,6 @@ namespace Migration.Tool.Source.Services; public class MediaFileMigrator( ILogger logger, - IDbContextFactory kxpContextFactory, ModelFacade modelFacade, KxpMediaFileFacade mediaFileFacade, IEntityMapper mediaFileInfoMapper, @@ -30,12 +26,8 @@ public class MediaFileMigrator( PrimaryKeyMappingContext primaryKeyMappingContext, EntityIdentityFacade entityIdentityFacade, IProtocol protocol - ) : IMediaFileMigrator, IDisposable + ) : IMediaFileMigrator { - private KxpContext kxpContext = kxpContextFactory.CreateDbContext(); - - public void Dispose() => kxpContext.Dispose(); - public async Task Handle(MigrateMediaLibrariesCommand request, CancellationToken cancellationToken) { var ksMediaLibraries = modelFacade.SelectAll(" ORDER BY LibraryID"); @@ -63,8 +55,8 @@ SELECT LibraryName FROM Media_Library GROUP BY LibraryName HAVING COUNT(*) > 1 if (modelFacade.SelectById(ksMediaLibrary.LibrarySiteID) is not { } ksSite) { protocol.Append(HandbookReferences - .InvalidSourceData() - .WithId(nameof(MediaLibrary.LibraryId), ksMediaLibrary.LibraryID) + .InvalidSourceData() + .WithId(nameof(MediaLibraryInfo.LibraryID), ksMediaLibrary.LibraryID) .WithMessage("Media library has missing site assigned") ); logger.LogError("Missing site, SiteID=={SiteId}", ksMediaLibrary.LibrarySiteID); @@ -92,9 +84,6 @@ SELECT LibraryName FROM Media_Library GROUP BY LibraryName HAVING COUNT(*) > 1 } catch (Exception ex) { - await kxpContext.DisposeAsync(); // reset context errors - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - protocol.Append(HandbookReferences .ErrorCreatingTargetInstance(ex) .NeedsManualAction() @@ -104,8 +93,8 @@ SELECT LibraryName FROM Media_Library GROUP BY LibraryName HAVING COUNT(*) > 1 continue; } - primaryKeyMappingContext.SetMapping( - r => r.LibraryId, + primaryKeyMappingContext.SetMapping( + r => r.LibraryID, ksMediaLibrary.LibraryID, mfi.LibraryID ); @@ -114,7 +103,7 @@ SELECT LibraryName FROM Media_Library GROUP BY LibraryName HAVING COUNT(*) > 1 } } - await RequireMigratedMediaFiles(migratedMediaLibraries, cancellationToken); + RequireMigratedMediaFiles(migratedMediaLibraries, cancellationToken); return new GenericCommandResult(); } @@ -137,95 +126,83 @@ private LoadMediaFileResult LoadMediaFileBinary(string? sourceMediaLibraryPath, return new LoadMediaFileResult(false, null, filePath); } - private async Task RequireMigratedMediaFiles(List<(IMediaLibrary sourceLibrary, ICmsSite sourceSite, MediaLibraryInfo targetLibrary)> migratedMediaLibraries, CancellationToken cancellationToken) + private void RequireMigratedMediaFiles(List<(IMediaLibrary sourceLibrary, ICmsSite sourceSite, MediaLibraryInfo targetLibrary)> migratedMediaLibraries, CancellationToken cancellationToken) { - var kxoDbContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - try + foreach (var (ksMediaLibrary, ksSite, targetMediaLibrary) in migratedMediaLibraries) { - foreach (var (ksMediaLibrary, ksSite, targetMediaLibrary) in migratedMediaLibraries) + string? sourceMediaLibraryPath = AssetFacade.GetMediaLibraryAbsolutePath(toolConfiguration, ksSite, ksMediaLibrary, modelFacade); + bool loadMediaFileData = !string.IsNullOrWhiteSpace(sourceMediaLibraryPath); + var ksMediaFiles = modelFacade.SelectWhere("FileLibraryID = @FileLibraryId", new SqlParameter("FileLibraryId", ksMediaLibrary.LibraryID)); + + foreach (var ksMediaFile in ksMediaFiles) { - string? sourceMediaLibraryPath = AssetFacade.GetMediaLibraryAbsolutePath(toolConfiguration, ksSite, ksMediaLibrary, modelFacade); - bool loadMediaFileData = !string.IsNullOrWhiteSpace(sourceMediaLibraryPath); - var ksMediaFiles = modelFacade.SelectWhere("FileLibraryID = @FileLibraryId", new SqlParameter("FileLibraryId", ksMediaLibrary.LibraryID)); + protocol.FetchedSource(ksMediaFile); - foreach (var ksMediaFile in ksMediaFiles) + bool found = false; + IUploadedFile? uploadedFile = null; + string? fullMediaPath = ""; + if (loadMediaFileData) { - protocol.FetchedSource(ksMediaFile); - - bool found = false; - IUploadedFile? uploadedFile = null; - string? fullMediaPath = ""; - if (loadMediaFileData) + (found, uploadedFile, fullMediaPath) = LoadMediaFileBinary(sourceMediaLibraryPath, ksMediaFile.FilePath, ksMediaFile.FileMimeType); + if (!found) { - (found, uploadedFile, fullMediaPath) = LoadMediaFileBinary(sourceMediaLibraryPath, ksMediaFile.FilePath, ksMediaFile.FileMimeType); - if (!found) - { - // report missing file (currently reported in mapper) - } - } - - string? librarySubfolder = Path.GetDirectoryName(ksMediaFile.FilePath); - - (bool isFixed, var safeMediaFileGuid) = entityIdentityFacade.Translate(ksMediaFile); - if (isFixed) - { - logger.LogWarning("MediaFile {File} has non-unique guid, new guid {Guid} was required", new { ksMediaFile.FileGUID, ksMediaFile.FileName, ksMediaFile.FileSiteID }, safeMediaFileGuid); + // report missing file (currently reported in mapper) } + } - var kxoMediaFile = mediaFileFacade.GetMediaFile(safeMediaFileGuid); + string? librarySubfolder = Path.GetDirectoryName(ksMediaFile.FilePath); - protocol.FetchedTarget(kxoMediaFile); + (bool isFixed, var safeMediaFileGuid) = entityIdentityFacade.Translate(ksMediaFile); + if (isFixed) + { + logger.LogWarning("MediaFile {File} has non-unique guid, new guid {Guid} was required", new { ksMediaFile.FileGUID, ksMediaFile.FileName, ksMediaFile.FileSiteID }, safeMediaFileGuid); + } - var source = new MediaFileInfoMapperSource(fullMediaPath, ksMediaFile, targetMediaLibrary.LibraryID, found ? uploadedFile : null, - librarySubfolder, toolConfiguration.MigrateOnlyMediaFileInfo.GetValueOrDefault(false), safeMediaFileGuid); - var mapped = mediaFileInfoMapper.Map(source, kxoMediaFile); - protocol.MappedTarget(mapped); + var kxoMediaFile = mediaFileFacade.GetMediaFile(safeMediaFileGuid); - if (mapped is { Success: true } result) - { - (var mf, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(mf, nameof(mf)); + protocol.FetchedTarget(kxoMediaFile); - try - { - if (newInstance) - { - mediaFileFacade.EnsureMediaFilePathExistsInLibrary(mf, targetMediaLibrary.LibraryID); - } + var source = new MediaFileInfoMapperSource(fullMediaPath, ksMediaFile, targetMediaLibrary.LibraryID, found ? uploadedFile : null, + librarySubfolder, toolConfiguration.MigrateOnlyMediaFileInfo.GetValueOrDefault(false), safeMediaFileGuid); + var mapped = mediaFileInfoMapper.Map(source, kxoMediaFile); + protocol.MappedTarget(mapped); - mediaFileFacade.SetMediaFile(mf, newInstance); - await kxpContext.SaveChangesAsync(cancellationToken); + if (mapped is { Success: true } result) + { + (var mf, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(mf, nameof(mf)); - protocol.Success(ksMediaFile, mf, mapped); - logger.LogEntitySetAction(newInstance, mf); - } - catch (Exception ex) + try + { + if (newInstance) { - await kxoDbContext.DisposeAsync(); // reset context errors - kxoDbContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - - protocol.Append(HandbookReferences - .ErrorCreatingTargetInstance(ex) - .NeedsManualAction() - .WithIdentityPrint(mf) - ); - logger.LogEntitySetError(ex, newInstance, mf); - continue; + mediaFileFacade.EnsureMediaFilePathExistsInLibrary(mf, targetMediaLibrary.LibraryID); } - primaryKeyMappingContext.SetMapping( - r => r.FileId, - ksMediaFile.FileID, - mf.FileID + mediaFileFacade.SetMediaFile(mf, newInstance); + + protocol.Success(ksMediaFile, mf, mapped); + logger.LogEntitySetAction(newInstance, mf); + } + catch (Exception ex) + { + protocol.Append(HandbookReferences + .ErrorCreatingTargetInstance(ex) + .NeedsManualAction() + .WithIdentityPrint(mf) ); + logger.LogEntitySetError(ex, newInstance, mf); + continue; } + + primaryKeyMappingContext.SetMapping( + r => r.FileID, + ksMediaFile.FileID, + mf.FileID + ); } } } - finally - { - await kxoDbContext.DisposeAsync(); - } } private record LoadMediaFileResult(bool Found, IUploadedFile? File, string? SearchedPath); diff --git a/KVA/Migration.Tool.Source/Services/PrimaryKeyLocatorService.cs b/KVA/Migration.Tool.Source/Services/PrimaryKeyLocatorService.cs index e387011c..9a871960 100644 --- a/KVA/Migration.Tool.Source/Services/PrimaryKeyLocatorService.cs +++ b/KVA/Migration.Tool.Source/Services/PrimaryKeyLocatorService.cs @@ -1,23 +1,24 @@ using System.Linq.Expressions; -using Microsoft.EntityFrameworkCore; +using CMS.ContactManagement; +using CMS.ContentEngine; +using CMS.DataEngine; +using CMS.Globalization; +using CMS.Membership; +using CMS.Modules; using Microsoft.Extensions.Logging; using Migration.Tool.Common; -using Migration.Tool.KXP.Context; using Migration.Tool.Source.Model; namespace Migration.Tool.Source.Services; public class PrimaryKeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, ModelFacade modelFacade ) : IPrimaryKeyLocatorService { public IEnumerable SelectAll(Expression> keyNameSelector) { - using var kxpContext = kxpContextFactory.CreateDbContext(); - var sourceType = typeof(T); string memberName = keyNameSelector.GetMemberName(); @@ -26,12 +27,12 @@ public IEnumerable SelectAll(Expression().ToList(); - var targetUsers = kxpContext.CmsUsers.Select(x => new { x.UserId, x.UserName, x.UserGuid }).ToList(); + var targetUsers = UserInfo.Provider.Get().Select(x => new { x.UserID, x.UserName, x.UserGUID }).ToList(); var result = sourceUsers.Join(targetUsers, a => new CmsUserKey(a.UserGUID, a.UserName), - b => new CmsUserKey(b.UserGuid, b.UserName), - (a, b) => new SourceTargetKeyMapping(a.UserID, b.UserId), + b => new CmsUserKey(b.UserGUID, b.UserName), + (a, b) => new SourceTargetKeyMapping(a.UserID, b.UserID), new KeyEqualityComparerWithLambda((ak, bk) => (ak?.UserGuid == bk?.UserGuid || ak?.UserName == bk?.UserName) && ak != null && bk != null) ); @@ -48,14 +49,13 @@ public IEnumerable SelectAll(Expression() .OrderBy(c => c.ContactCreated) .Select(x => new { x.ContactID, x.ContactGUID }).ToList(); - var target = kxpContext.OmContacts - .OrderBy(c => c.ContactCreated) - .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); + var target = ContactInfo.Provider.Get().OrderBy(nameof(ContactInfo.ContactCreated)) + .Select(x => new { x.ContactID, x.ContactGUID }).ToList(); var result = source.Join(target, a => a.ContactGUID, - b => b.ContactGuid, - (a, b) => new SourceTargetKeyMapping(a.ContactID, b.ContactId) + b => b.ContactGUID, + (a, b) => new SourceTargetKeyMapping(a.ContactID, b.ContactID) ); foreach (var resultingMapping in result) @@ -69,12 +69,12 @@ public IEnumerable SelectAll(Expression().Select(x => new { x.StateID, x.StateName }).ToList(); - var target = kxpContext.CmsStates.Select(x => new { x.StateId, x.StateName }).ToList(); + var target = StateInfo.Provider.Get().Select(x => new { x.StateID, x.StateName }).ToList(); var result = source.Join(target, a => a.StateName, b => b.StateName, - (a, b) => new SourceTargetKeyMapping(a.StateID, b.StateId) + (a, b) => new SourceTargetKeyMapping(a.StateID, b.StateID) ); foreach (var resultingMapping in result) @@ -88,12 +88,12 @@ public IEnumerable SelectAll(Expression().Select(x => new { x.CountryID, x.CountryName }).ToList(); - var target = kxpContext.CmsCountries.Select(x => new { x.CountryId, x.CountryName }).ToList(); + var target = CountryInfo.Provider.Get().Select(x => new { x.CountryID, x.CountryName }).ToList(); var result = source.Join(target, a => a.CountryName, b => b.CountryName, - (a, b) => new SourceTargetKeyMapping(a.CountryID, b.CountryId) + (a, b) => new SourceTargetKeyMapping(a.CountryID, b.CountryID) ); foreach (var resultingMapping in result) @@ -110,8 +110,6 @@ public IEnumerable SelectAll(Expression(Expression> keyNameSelector, int sourceId, out int targetId) { - using var kxpContext = kxpContextFactory.CreateDbContext(); - var sourceType = typeof(T); targetId = -1; try @@ -119,63 +117,63 @@ public bool TryLocate(Expression> keyNameSelector, int source if (sourceType == typeof(ICmsResource)) { var sourceGuid = modelFacade.SelectById(sourceId)?.ResourceGUID; - targetId = kxpContext.CmsResources.Where(x => x.ResourceGuid == sourceGuid).Select(x => x.ResourceId).Single(); + targetId = ResourceInfo.Provider.Get().WhereEquals(nameof(ResourceInfo.ResourceGUID), sourceGuid).Select(x => x.ResourceID).Single(); return true; } if (sourceType == typeof(ICmsClass)) { var sourceGuid = modelFacade.SelectById(sourceId)?.ClassGUID; - targetId = kxpContext.CmsClasses.Where(x => x.ClassGuid == sourceGuid).Select(x => x.ClassId).Single(); + targetId = DataClassInfoProvider.GetClasses().Where(x => x.ClassGUID == sourceGuid).Select(x => x.ClassID).Single(); return true; } if (sourceType == typeof(ICmsUser)) { var source = modelFacade.SelectById(sourceId); - targetId = kxpContext.CmsUsers.Where(x => x.UserGuid == source.UserGUID || x.UserName == source.UserName).Select(x => x.UserId).Single(); + targetId = UserInfo.Provider.Get().WhereEquals(nameof(UserInfo.UserGUID), source.UserGUID).Or().WhereEquals(nameof(UserInfo.UserName), source.UserName).Select(x => x.UserID).Single(); return true; } if (sourceType == typeof(ICmsRole)) { var sourceGuid = modelFacade.SelectById(sourceId)?.RoleGUID; - targetId = kxpContext.CmsRoles.Where(x => x.RoleGuid == sourceGuid).Select(x => x.RoleId).Single(); + targetId = RoleInfo.Provider.Get().WhereEquals(nameof(RoleInfo.RoleGUID), sourceGuid).Select(x => x.RoleID).Single(); return true; } if (sourceType == typeof(ICmsSite)) { var sourceGuid = modelFacade.SelectById(sourceId)?.SiteGUID; - targetId = kxpContext.CmsChannels.Where(x => x.ChannelGuid == sourceGuid).Select(x => x.ChannelId).Single(); + targetId = ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), sourceGuid).Select(x => x.ChannelID).Single(); return true; } if (sourceType == typeof(ICmsState)) { string? sourceName = modelFacade.SelectById(sourceId)?.StateName; - targetId = kxpContext.CmsStates.Where(x => x.StateName == sourceName).Select(x => x.StateId).Single(); + targetId = StateInfo.Provider.Get().WhereEquals(nameof(StateInfo.StateName), sourceName).Select(x => x.StateID).Single(); return true; } if (sourceType == typeof(ICmsCountry)) { string? sourceName = modelFacade.SelectById(sourceId)?.CountryName; - targetId = kxpContext.CmsCountries.Where(x => x.CountryName == sourceName).Select(x => x.CountryId).Single(); + targetId = CountryInfo.Provider.Get().WhereEquals(nameof(CountryInfo.CountryName), sourceName).Select(x => x.CountryID).Single(); return true; } if (sourceType == typeof(IOmContactStatus)) { string? sourceName = modelFacade.SelectById(sourceId)?.ContactStatusName; - targetId = kxpContext.OmContactStatuses.Where(x => x.ContactStatusName == sourceName).Select(x => x.ContactStatusId).Single(); + targetId = ContactStatusInfo.Provider.Get().WhereEquals(nameof(ContactStatusInfo.ContactStatusName), sourceName).Select(x => x.ContactStatusID).Single(); return true; } if (sourceType == typeof(IOmContact)) { var sourceGuid = modelFacade.SelectById(sourceId)?.ContactGUID; - targetId = kxpContext.OmContacts.Where(x => x.ContactGuid == sourceGuid).Select(x => x.ContactId).Single(); + targetId = ContactInfo.Provider.Get().WhereEquals(nameof(ContactInfo.ContactGUID), sourceGuid).Select(x => x.ContactID).Single(); return true; } } diff --git a/Migration.Tool.Common/EntityConfiguration.cs b/Migration.Tool.Common/EntityConfiguration.cs index 773bd058..94cdd41c 100644 --- a/Migration.Tool.Common/EntityConfiguration.cs +++ b/Migration.Tool.Common/EntityConfiguration.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; - +using CMS.DataEngine; using Migration.Tool.Common.Helpers; namespace Migration.Tool.Common; @@ -24,6 +24,15 @@ public EntityConfiguration GetEntityConfiguration(string? tableName) public EntityConfiguration GetEntityConfiguration() { string? tableName = ReflectionHelper.GetFirstAttributeOrNull()?.Name; + if (tableName is null) + { + // If table is not specified by annotation at the type, try deriving the table name from OBJECT_TYPE static field (works for ProviderInfos) + object? objectType = ReflectionHelper.GetStaticFieldOrNull(nameof(DataClassInfo.OBJECT_TYPE)); + if (objectType is not null) + { + tableName = ((string)objectType).Replace('.', '_'); + } + } return GetEntityConfiguration(tableName); } diff --git a/Migration.Tool.Common/Helpers/ReflectionHelper.cs b/Migration.Tool.Common/Helpers/ReflectionHelper.cs index 3107ea77..465e26cd 100644 --- a/Migration.Tool.Common/Helpers/ReflectionHelper.cs +++ b/Migration.Tool.Common/Helpers/ReflectionHelper.cs @@ -93,6 +93,12 @@ public static bool TryGetPropertyValue(T obj, string propertyName, StringCompari return StaticPropertyGetterMaps[propertyName].PropertyGetMethod!.Invoke(null, Array.Empty()); } + + public static object? GetStaticFieldOrNull(string memberName) + { + var type = typeof(T); + return type.GetField(memberName, BindingFlags.Static | BindingFlags.Public)?.GetValue(type); + } } public class ObjectPropertyGetterMap diff --git a/Migration.Tool.Common/Migration.Tool.Common.csproj b/Migration.Tool.Common/Migration.Tool.Common.csproj index c8c954c8..811cdf28 100644 --- a/Migration.Tool.Common/Migration.Tool.Common.csproj +++ b/Migration.Tool.Common/Migration.Tool.Common.csproj @@ -19,8 +19,8 @@ - + - + diff --git a/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs b/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs index 3acb83a6..7a1911df 100644 --- a/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs +++ b/Migration.Tool.Core.K11/Services/PrimaryKeyLocatorService.cs @@ -172,8 +172,8 @@ public bool TryLocate(Expression> keyNameSelector, int source if (sourceType == typeof(OmContactStatus)) { - string k11Guid = kx11Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); - targetId = ContactStatusInfo.Provider.Get().WhereEquals(nameof(ContactStatusInfo.ContactStatusName), k11Guid).Select(x => x.ContactStatusID).Single(); + string statusName = kx11Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); + targetId = ContactStatusInfo.Provider.Get().WhereEquals(nameof(ContactStatusInfo.ContactStatusName), statusName).Select(x => x.ContactStatusID).Single(); return true; } From 3ba86ca25d9478a44526b0613de219bc8e52318d Mon Sep 17 00:00:00 2001 From: akfakmot Date: Fri, 15 Nov 2024 19:19:18 +0100 Subject: [PATCH 06/10] Add consent hash retainment to Migration.Tool.Core.K11 Add: Add consent hash retainment to Migration.Tool.Core.K11 --- .../MigrateContactManagementCommandHandler.cs | 2 +- .../MigrateDataProtectionCommandHandler.cs | 31 ++++++++++++++++--- .../Mappers/CmsConsentMapper.cs | 1 + 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs index 5e23d54b..c564c2a9 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateContactManagementCommandHandler.cs @@ -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); diff --git a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs index 4b8ab216..0cef11a6 100644 --- a/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs +++ b/Migration.Tool.Core.K11/Handlers/MigrateDataProtectionCommandHandler.cs @@ -56,10 +56,33 @@ private async Task MigrateConsent(CancellationToken cancellationT (var consentInfo, bool newInstance) = result; ArgumentNullException.ThrowIfNull(consentInfo, nameof(consentInfo)); - ConsentInfo.Provider.Set(consentInfo); - protocol.Success(k11Consent, consentInfo, mapped); - logger.LogEntitySetAction(newInstance, consentInfo); - primaryKeyMappingContext.SetMapping(r => r.ConsentId, k11Consent.ConsentId, consentInfo.ConsentID); + try + { + using (var conn = ConnectionHelper.GetConnection()) + { + using var scope = new CMSTransactionScope(conn); + string originalHash = consentInfo.ConsentHash; + + ConsentInfo.Provider.Set(consentInfo); + + // Provider regenerates the hash. Manually revert to the original one + conn.DataConnection.ExecuteNonQuery("UPDATE [CMS_Consent] SET ConsentHash=@originalHash", new QueryDataParameters() { { "originalHash", originalHash } }, QueryTypeEnum.SQLQuery, true); + scope.Commit(); + } + + protocol.Success(k11Consent, consentInfo, mapped); + logger.LogEntitySetAction(newInstance, consentInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentId, k11Consent.ConsentId, consentInfo.ConsentID); + } + catch (Exception ex) + { + logger.LogEntitySetError(ex, newInstance, consentInfo); + protocol.Append(HandbookReferences + .ErrorCreatingTargetInstance(ex) + .NeedsManualAction() + .WithIdentityPrint(consentInfo) + ); + } } } diff --git a/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs b/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs index 1e138cdd..99538b4a 100644 --- a/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs +++ b/Migration.Tool.Core.K11/Mappers/CmsConsentMapper.cs @@ -25,6 +25,7 @@ protected override ConsentInfo MapInternal(CmsConsent source, ConsentInfo target target.ConsentContent = ConsentContentPatcher.PatchConsentContent(source.ConsentContent, defaultContentLanguageInfo); target.ConsentGuid = source.ConsentGuid; target.ConsentLastModified = source.ConsentLastModified; + target.SetValue(nameof(target.ConsentHash), source.ConsentHash); return target; } From 352589a60441a78b2435d0f0d17e74feb14e74ff Mon Sep 17 00:00:00 2001 From: akfakmot Date: Fri, 15 Nov 2024 19:19:50 +0100 Subject: [PATCH 07/10] Remove dependencies of Migration.Tool.Core.KX12 on Migration.Tool.KXP Refactor: Remove dependencies of Migration.Tool.Core.KX12 on Migration.Tool.KXP --- .../Contexts/KeyMappingContext.cs | 6 +- .../MigrateContactManagementCommandHandler.cs | 143 +++++++------- .../MigrateDataProtectionCommandHandler.cs | 175 +++++------------- .../Handlers/MigrateUsersCommandHandler.cs | 3 +- Migration.Tool.Core.KX12/Helpers/Printer.cs | 34 ++-- .../KX12CoreDiExtensions.cs | 14 +- .../Mappers/CmsConsentAgreementMapper.cs | 12 +- .../Mappers/CmsConsentArchiveMapper.cs | 10 +- .../Mappers/CmsConsentMapper.cs | 11 +- .../Mappers/CmsFormMapper.cs | 41 ---- .../Mappers/CmsSettingsCategoryMapper.cs | 97 ---------- .../Mappers/CmsUserMapper.cs | 55 ------ .../Mappers/OmContactGroupMapper.cs | 34 +++- .../Mappers/OmContactStatusMapper.cs | 8 +- .../Migration.Tool.Core.KX12.csproj | 9 +- .../Services/KeyLocatorService.cs | 24 +-- .../Services/PrimaryKeyLocatorService.cs | 62 +++---- 17 files changed, 233 insertions(+), 505 deletions(-) delete mode 100644 Migration.Tool.Core.KX12/Mappers/CmsSettingsCategoryMapper.cs delete mode 100644 Migration.Tool.Core.KX12/Mappers/CmsUserMapper.cs diff --git a/Migration.Tool.Core.KX12/Contexts/KeyMappingContext.cs b/Migration.Tool.Core.KX12/Contexts/KeyMappingContext.cs index 112290e6..d0b1edff 100644 --- a/Migration.Tool.Core.KX12/Contexts/KeyMappingContext.cs +++ b/Migration.Tool.Core.KX12/Contexts/KeyMappingContext.cs @@ -11,15 +11,15 @@ public class KeyMappingContext(PrimaryKeyMappingContext primaryKeyMappingContext public MapSourceKeyResult MapSourceKey(Expression> sourceKeySelector, Expression> sourceGuidSelector, object? sourceKey, - Expression> targetKeySelector, - Expression> targetGuidSelector) where TSource : class where TTarget : class + Func targetKeySelector, + Func 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(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(true, located); } diff --git a/Migration.Tool.Core.KX12/Handlers/MigrateContactManagementCommandHandler.cs b/Migration.Tool.Core.KX12/Handlers/MigrateContactManagementCommandHandler.cs index 1ebcb8e1..d585f5f5 100644 --- a/Migration.Tool.Core.KX12/Handlers/MigrateContactManagementCommandHandler.cs +++ b/Migration.Tool.Core.KX12/Handlers/MigrateContactManagementCommandHandler.cs @@ -1,10 +1,10 @@ using CMS.Activities; using CMS.ContactManagement; using CMS.ContentEngine; - +using CMS.Globalization; +using CMS.Membership; using MediatR; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; @@ -16,14 +16,11 @@ using Migration.Tool.Core.KX12.Helpers; using Migration.Tool.Core.KX12.Services; using Migration.Tool.KXP.Api; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Handlers; public class MigrateContactManagementCommandHandler( ILogger logger, - IDbContextFactory kxpContextFactory, BulkDataCopyService bulkDataCopyService, ToolConfiguration toolConfiguration, PrimaryKeyMappingContext primaryKeyMappingContext, @@ -33,12 +30,8 @@ public class MigrateContactManagementCommandHandler( ISpoiledGuidContext spoiledGuidContext, IProtocol protocol ) - : IRequestHandler, IDisposable + : IRequestHandler { - private readonly KxpContext kxpContext = kxpContextFactory.CreateDbContext(); - - public void Dispose() => kxpContext.Dispose(); - public Task Handle(MigrateContactManagementCommand request, CancellationToken cancellationToken) { countryMigrator.MigrateCountriesAndStates(); @@ -62,36 +55,36 @@ public Task Handle(MigrateContactManagementCommand request, Cance { var requiredColumnsForContactMigration = new Dictionary { - { nameof(KX12M.OmContact.ContactId), nameof(OmContact.ContactId) }, - { nameof(KX12M.OmContact.ContactFirstName), nameof(OmContact.ContactFirstName) }, - { nameof(KX12M.OmContact.ContactMiddleName), nameof(OmContact.ContactMiddleName) }, - { nameof(KX12M.OmContact.ContactLastName), nameof(OmContact.ContactLastName) }, - { nameof(KX12M.OmContact.ContactJobTitle), nameof(OmContact.ContactJobTitle) }, - { nameof(KX12M.OmContact.ContactAddress1), nameof(OmContact.ContactAddress1) }, - { nameof(KX12M.OmContact.ContactCity), nameof(OmContact.ContactCity) }, - { nameof(KX12M.OmContact.ContactZip), nameof(OmContact.ContactZip) }, - { nameof(KX12M.OmContact.ContactStateId), nameof(OmContact.ContactStateId) }, - { nameof(KX12M.OmContact.ContactCountryId), nameof(OmContact.ContactCountryId) }, - { nameof(KX12M.OmContact.ContactMobilePhone), nameof(OmContact.ContactMobilePhone) }, - { nameof(KX12M.OmContact.ContactBusinessPhone), nameof(OmContact.ContactBusinessPhone) }, - { nameof(KX12M.OmContact.ContactEmail), nameof(OmContact.ContactEmail) }, - // No support 2022-07-07 { nameof(OmContact.ContactBirthday), nameof(KXO.Models.OmContact.ContactBirthday) }, - { nameof(KX12M.OmContact.ContactGender), nameof(OmContact.ContactGender) }, - // { nameof(OmContact.ContactStatusId), nameof(KXO.Models.OmContact.ContactStatusId) }, // No support 2022-07-07 but needs to be mapped because of constraint - { nameof(KX12M.OmContact.ContactNotes), nameof(OmContact.ContactNotes) }, - { nameof(KX12M.OmContact.ContactOwnerUserId), nameof(OmContact.ContactOwnerUserId) }, - // No support 2022-07-07 { nameof(OmContact.ContactMonitored), nameof(KXO.Models.OmContact.ContactMonitored) }, - { nameof(KX12M.OmContact.ContactGuid), nameof(OmContact.ContactGuid) }, - { nameof(KX12M.OmContact.ContactLastModified), nameof(OmContact.ContactLastModified) }, - { nameof(KX12M.OmContact.ContactCreated), nameof(OmContact.ContactCreated) }, - // No support 2022-07-07 { nameof(OmContact.ContactBounces), nameof(KXO.Models.OmContact.ContactBounces) }, - { nameof(KX12M.OmContact.ContactCampaign), nameof(OmContact.ContactCampaign) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadId), nameof(KXO.Models.OmContact.ContactSalesForceLeadId) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationDisabled), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDisabled) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDateTime) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationSuspensionDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationSuspensionDateTime) }, - { nameof(KX12M.OmContact.ContactCompanyName), nameof(OmContact.ContactCompanyName) } - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationRequired), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationRequired) }, + { nameof(KX12M.OmContact.ContactId), nameof(ContactInfo.ContactID) }, + { nameof(KX12M.OmContact.ContactFirstName), nameof(ContactInfo.ContactFirstName) }, + { nameof(KX12M.OmContact.ContactMiddleName), nameof(ContactInfo.ContactMiddleName) }, + { nameof(KX12M.OmContact.ContactLastName), nameof(ContactInfo.ContactLastName) }, + { nameof(KX12M.OmContact.ContactJobTitle), nameof(ContactInfo.ContactJobTitle) }, + { nameof(KX12M.OmContact.ContactAddress1), nameof(ContactInfo.ContactAddress1) }, + { nameof(KX12M.OmContact.ContactCity), nameof(ContactInfo.ContactCity) }, + { nameof(KX12M.OmContact.ContactZip), nameof(ContactInfo.ContactZIP) }, + { nameof(KX12M.OmContact.ContactStateId), nameof(ContactInfo.ContactStateID) }, + { nameof(KX12M.OmContact.ContactCountryId), nameof(ContactInfo.ContactCountryID) }, + { nameof(KX12M.OmContact.ContactMobilePhone), nameof(ContactInfo.ContactMobilePhone) }, + { nameof(KX12M.OmContact.ContactBusinessPhone), nameof(ContactInfo.ContactBusinessPhone) }, + { nameof(KX12M.OmContact.ContactEmail), nameof(ContactInfo.ContactEmail) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactBirthday), nameof(KXO.Models.OmContact.ContactBirthday) }, + { nameof(KX12M.OmContact.ContactGender), nameof(ContactInfo.ContactGender) }, + // { nameof(ContactInfo.ContactStatusId), nameof(KXO.Models.OmContact.ContactStatusId) }, // No support 2022-07-07 but needs to be mapped because of constraint + { nameof(KX12M.OmContact.ContactNotes), nameof(ContactInfo.ContactNotes) }, + { nameof(KX12M.OmContact.ContactOwnerUserId), nameof(ContactInfo.ContactOwnerUserID) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactMonitored), nameof(KXO.Models.OmContact.ContactMonitored) }, + { nameof(KX12M.OmContact.ContactGuid), nameof(ContactInfo.ContactGUID) }, + { nameof(KX12M.OmContact.ContactLastModified), nameof(ContactInfo.ContactLastModified) }, + { nameof(KX12M.OmContact.ContactCreated), nameof(ContactInfo.ContactCreated) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactBounces), nameof(KXO.Models.OmContact.ContactBounces) }, + { nameof(KX12M.OmContact.ContactCampaign), nameof(ContactInfo.ContactCampaign) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadId), nameof(KXO.Models.OmContact.ContactSalesForceLeadId) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationDisabled), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDisabled) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDateTime) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationSuspensionDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationSuspensionDateTime) }, + { nameof(KX12M.OmContact.ContactCompanyName), nameof(ContactInfo.ContactCompanyName) } + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationRequired), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationRequired) }, }; foreach (var cfi in kxpClassFacade.GetCustomizedFieldInfos(ContactInfo.TYPEINFO.ObjectClassName)) @@ -149,7 +142,7 @@ public Task Handle(MigrateContactManagementCommand request, Cance private ValueInterceptorResult ContactValueInterceptor(int ordinal, string columnName, object value, Dictionary currentRow) { - if (columnName.Equals(nameof(OmContact.ContactCompanyName), StringComparison.InvariantCultureIgnoreCase)) + if (columnName.Equals(nameof(ContactInfo.ContactCompanyName), StringComparison.InvariantCultureIgnoreCase)) { // autofix removed in favor of error report and data consistency // var truncatedValue = SqlDataTypeHelper.TruncateString(value, 100); @@ -171,7 +164,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(OmContact.ContactOwnerUserId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceUserId) + if (columnName.Equals(nameof(ContactInfo.ContactOwnerUserID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceUserId) { switch (primaryKeyMappingContext.MapSourceId(u => u.UserId, sourceUserId)) { @@ -180,18 +173,18 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum case { Success: false }: { // try search member - if (keyMappingContext.MapSourceKey( + if (keyMappingContext.MapSourceKey( s => s.UserId, s => s.UserGuid, sourceUserId, - t => t.MemberId, - t => t.MemberGuid + t => t.MemberID, + MemberInfo.Provider.Get ) is { Success: true, Mapped: { } memberId }) { return ValueInterceptorResult.ReplaceValue(memberId); } - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -201,7 +194,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(OmContact.ContactStateId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceStateId) + if (columnName.Equals(nameof(ContactInfo.ContactStateID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceStateId) { switch (primaryKeyMappingContext.MapSourceId(u => u.StateId, sourceStateId.NullIfZero())) { @@ -209,7 +202,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -219,7 +212,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(OmContact.ContactCountryId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceCountryId) + if (columnName.Equals(nameof(ContactInfo.ContactCountryID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceCountryId) { switch (primaryKeyMappingContext.MapSourceId(u => u.CountryId, sourceCountryId.NullIfZero())) { @@ -227,7 +220,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -249,25 +242,25 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum { var requiredColumnsForContactMigration = new Dictionary { - { nameof(KX12M.OmActivity.ActivityId), nameof(OmActivity.ActivityId) }, - { nameof(KX12M.OmActivity.ActivityContactId), nameof(OmActivity.ActivityContactId) }, - { nameof(KX12M.OmActivity.ActivityCreated), nameof(OmActivity.ActivityCreated) }, - { nameof(KX12M.OmActivity.ActivityType), nameof(OmActivity.ActivityType) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityItemId), nameof(KXO.Models.OmActivity.ActivityItemId) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityItemDetailId), nameof(KXO.Models.OmActivity.ActivityItemDetailId) }, - { nameof(KX12M.OmActivity.ActivityValue), nameof(OmActivity.ActivityValue) }, - { nameof(KX12M.OmActivity.ActivityUrl), nameof(OmActivity.ActivityUrl) }, - { nameof(KX12M.OmActivity.ActivityTitle), nameof(OmActivity.ActivityTitle) }, - { nameof(KX12M.OmActivity.ActivitySiteId), nameof(OmActivity.ActivityChannelId) }, - { nameof(KX12M.OmActivity.ActivityComment), nameof(OmActivity.ActivityComment) }, - // { nameof(OmActivity.ActivityCampaign), nameof(KXP.Models.OmActivity.ActivityCampaign) }, // deprecated without replacement in v27 - { nameof(KX12M.OmActivity.ActivityUrlreferrer), nameof(OmActivity.ActivityUrlreferrer) }, - { nameof(KX12M.OmActivity.ActivityCulture), nameof(OmActivity.ActivityLanguageId) }, - { nameof(KX12M.OmActivity.ActivityNodeId), nameof(OmActivity.ActivityWebPageItemGuid) }, - { nameof(KX12M.OmActivity.ActivityUtmsource), nameof(OmActivity.ActivityUtmsource) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityAbvariantName), nameof(KXO.Models.OmActivity.ActivityAbvariantName) }, - // OBSOLETE 26.0.0: { nameof(OmActivity.ActivityUrlhash), nameof(KXP.Models.OmActivity.ActivityUrlhash) }, - { nameof(KX12M.OmActivity.ActivityUtmcontent), nameof(OmActivity.ActivityUtmcontent) } + { nameof(KX12M.OmActivity.ActivityId), nameof(ActivityInfo.ActivityID) }, + { nameof(KX12M.OmActivity.ActivityContactId), nameof(ActivityInfo.ActivityContactID) }, + { nameof(KX12M.OmActivity.ActivityCreated), nameof(ActivityInfo.ActivityCreated) }, + { nameof(KX12M.OmActivity.ActivityType), nameof(ActivityInfo.ActivityType) }, + // No support 2022-07-07 { nameof(ActivityInfo.ActivityItemId), nameof(KXO.Models.OmActivity.ActivityItemId) }, + // No support 2022-07-07 { nameof(ActivityInfo.ActivityItemDetailId), nameof(KXO.Models.OmActivity.ActivityItemDetailId) }, + { nameof(KX12M.OmActivity.ActivityValue), nameof(ActivityInfo.ActivityValue) }, + { nameof(KX12M.OmActivity.ActivityUrl), nameof(ActivityInfo.ActivityURL) }, + { nameof(KX12M.OmActivity.ActivityTitle), nameof(ActivityInfo.ActivityTitle) }, + { nameof(KX12M.OmActivity.ActivitySiteId), nameof(ActivityInfo.ActivityChannelID) }, + { nameof(KX12M.OmActivity.ActivityComment), nameof(ActivityInfo.ActivityComment) }, + // { nameof(ActivityInfo.ActivityCampaign), nameof(KXP.Models.OmActivity.ActivityCampaign) }, // deprecated without replacement in v27 + { nameof(KX12M.OmActivity.ActivityUrlreferrer), nameof(ActivityInfo.ActivityURLReferrer) }, + { nameof(KX12M.OmActivity.ActivityCulture), nameof(ActivityInfo.ActivityLanguageID) }, + { nameof(KX12M.OmActivity.ActivityNodeId), nameof(ActivityInfo.ActivityWebPageItemGUID) }, + { nameof(KX12M.OmActivity.ActivityUtmsource), nameof(ActivityInfo.ActivityUTMSource) }, + // No support 2022-07-07 { nameof(ActivityInfo.ActivityAbvariantName), nameof(KXO.Models.OmActivity.ActivityAbvariantName) }, + // OBSOLETE 26.0.0: { nameof(ActivityInfo.ActivityUrlhash), nameof(KXP.Models.OmActivity.ActivityUrlhash) }, + { nameof(KX12M.OmActivity.ActivityUtmcontent), nameof(ActivityInfo.ActivityUTMContent) } }; foreach (var cfi in kxpClassFacade.GetCustomizedFieldInfos(ActivityInfo.TYPEINFO.ObjectClassName)) @@ -316,12 +309,12 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin if (columnName.Equals(nameof(KX12M.OmActivity.ActivitySiteId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceActivitySiteId) { - var result = keyMappingContext.MapSourceKey( + var result = keyMappingContext.MapSourceKey( s => s.SiteId, s => s.SiteGuid, sourceActivitySiteId.NullIfZero(), - t => t.ChannelId, - t => t.ChannelGuid + t => t.ChannelID, + guid => ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), guid).SingleOrDefault() ); switch (result) { @@ -340,7 +333,7 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) + .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; @@ -373,14 +366,14 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) + .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; } } - if (columnName.Equals(nameof(OmActivity.ActivityLanguageId), StringComparison.InvariantCultureIgnoreCase) && value is string cultureCode) + if (columnName.Equals(nameof(ActivityInfo.ActivityLanguageID), StringComparison.InvariantCultureIgnoreCase) && value is string cultureCode) { return ValueInterceptorResult.ReplaceValue(ContentLanguageInfoProvider.ProviderObject.Get(cultureCode)?.ContentLanguageID); } diff --git a/Migration.Tool.Core.KX12/Handlers/MigrateDataProtectionCommandHandler.cs b/Migration.Tool.Core.KX12/Handlers/MigrateDataProtectionCommandHandler.cs index 0af66d60..3abb0306 100644 --- a/Migration.Tool.Core.KX12/Handlers/MigrateDataProtectionCommandHandler.cs +++ b/Migration.Tool.Core.KX12/Handlers/MigrateDataProtectionCommandHandler.cs @@ -1,8 +1,7 @@ +using CMS.DataEngine; using CMS.DataProtection; using MediatR; - -using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -11,49 +10,39 @@ using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; using Migration.Tool.KX12.Context; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Handlers; -public class MigrateDataProtectionCommandHandler : IRequestHandler, IDisposable +public class MigrateDataProtectionCommandHandler : IRequestHandler { private static readonly int batchSize = 1000; - private readonly IEntityMapper consentAgreementMapper; - private readonly IEntityMapper consentArchiveMapper; - private readonly IEntityMapper consentMapper; + private readonly IEntityMapper consentAgreementMapper; + private readonly IEntityMapper consentArchiveMapper; + private readonly IEntityMapper consentMapper; private readonly IDbContextFactory kx12ContextFactory; - private readonly IDbContextFactory kxpContextFactory; private readonly ILogger logger; private readonly PrimaryKeyMappingContext primaryKeyMappingContext; private readonly IProtocol protocol; - private KxpContext kxpContext; - public MigrateDataProtectionCommandHandler( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory kx12ContextFactory, - IEntityMapper consentMapper, - IEntityMapper consentArchiveMapper, - IEntityMapper consentAgreementMapper, + IEntityMapper consentMapper, + IEntityMapper consentArchiveMapper, + IEntityMapper consentAgreementMapper, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol ) { this.logger = logger; - this.kxpContextFactory = kxpContextFactory; this.kx12ContextFactory = kx12ContextFactory; this.consentMapper = consentMapper; this.consentArchiveMapper = consentArchiveMapper; this.consentAgreementMapper = consentAgreementMapper; this.primaryKeyMappingContext = primaryKeyMappingContext; this.protocol = protocol; - kxpContext = this.kxpContextFactory.CreateDbContext(); } - public void Dispose() => kxpContext.Dispose(); - public async Task Handle(MigrateDataProtectionCommand request, CancellationToken cancellationToken) { await MigrateConsent(cancellationToken); @@ -72,7 +61,7 @@ private async Task MigrateConsent(CancellationToken cancellationT protocol.FetchedSource(k12Consent); logger.LogTrace("Migrating consent {ConsentName} with ConsentGuid {ConsentGuid}", k12Consent.ConsentName, k12Consent.ConsentGuid); - var kxoConsent = await kxpContext.CmsConsents.FirstOrDefaultAsync(consent => consent.ConsentGuid == k12Consent.ConsentGuid, cancellationToken); + var kxoConsent = ConsentInfo.Provider.Get().WhereEquals(nameof(ConsentInfo.ConsentGuid), k12Consent.ConsentGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsent); var mapped = consentMapper.Map(k12Consent, kxoConsent); @@ -80,37 +69,35 @@ private async Task MigrateConsent(CancellationToken cancellationT if (mapped is { Success: true } result) { - (var cmsConsent, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsent, nameof(cmsConsent)); - - if (newInstance) - { - kxpContext.CmsConsents.Add(cmsConsent); - } - else - { - kxpContext.CmsConsents.Update(cmsConsent); - } + (var consentInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(consentInfo, nameof(consentInfo)); try { - await kxpContext.SaveChangesAsync(cancellationToken); + using (var conn = ConnectionHelper.GetConnection()) + { + using var scope = new CMSTransactionScope(conn); + string originalHash = consentInfo.ConsentHash; + + ConsentInfo.Provider.Set(consentInfo); + + // Provider regenerates the hash. Manually revert to the original one + conn.DataConnection.ExecuteNonQuery("UPDATE [CMS_Consent] SET ConsentHash=@originalHash", new QueryDataParameters() { { "originalHash", originalHash } }, QueryTypeEnum.SQLQuery, true); + scope.Commit(); + } - protocol.Success(k12Consent, cmsConsent, mapped); - logger.LogEntitySetAction(newInstance, cmsConsent); - primaryKeyMappingContext.SetMapping(r => r.ConsentId, k12Consent.ConsentId, cmsConsent.ConsentId); + protocol.Success(k12Consent, consentInfo, mapped); + logger.LogEntitySetAction(newInstance, consentInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentId, k12Consent.ConsentId, consentInfo.ConsentID); } - /*Violation in unique index or Violation in unique constraint */ - catch (DbUpdateException dbUpdateException) when (dbUpdateException.InnerException is SqlException { Number: 2601 or 2627 } sqlException) + catch (Exception ex) { - logger.LogEntitySetError(sqlException, newInstance, k12Consent); + logger.LogEntitySetError(ex, newInstance, consentInfo); protocol.Append(HandbookReferences - .DbConstraintBroken(sqlException, k12Consent) - .WithMessage("Failed to migrate consent, target database constraint broken.") + .ErrorCreatingTargetInstance(ex) + .NeedsManualAction() + .WithIdentityPrint(consentInfo) ); - - await kxpContext.DisposeAsync(); - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); } } } @@ -127,7 +114,7 @@ private async Task MigrateConsentArchive(CancellationToken cancel protocol.FetchedSource(k12ArchiveConsent); logger.LogTrace("Migrating consent archive with ConsentArchiveGuid {ConsentGuid}", k12ArchiveConsent.ConsentArchiveGuid); - var kxoConsentArchive = await kxpContext.CmsConsentArchives.FirstOrDefaultAsync(consentArchive => consentArchive.ConsentArchiveGuid == k12ArchiveConsent.ConsentArchiveGuid, cancellationToken); + var kxoConsentArchive = ConsentArchiveInfo.Provider.Get().WhereEquals(nameof(ConsentArchiveInfo.ConsentArchiveGuid), k12ArchiveConsent.ConsentArchiveGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsentArchive); var mapped = consentArchiveMapper.Map(k12ArchiveConsent, kxoConsentArchive); @@ -135,39 +122,14 @@ private async Task MigrateConsentArchive(CancellationToken cancel if (mapped is { Success: true } result) { - (var cmsConsentArchive, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsentArchive, nameof(cmsConsentArchive)); - - if (newInstance) - { - kxpContext.CmsConsentArchives.Add(cmsConsentArchive); - } - else - { - kxpContext.CmsConsentArchives.Update(cmsConsentArchive); - } - - try - { - await kxpContext.SaveChangesAsync(cancellationToken); - - protocol.Success(k12ArchiveConsent, cmsConsentArchive, mapped); - logger.LogEntitySetAction(newInstance, cmsConsentArchive); - primaryKeyMappingContext.SetMapping(r => r.ConsentArchiveGuid, - k12ArchiveConsent.ConsentArchiveId, cmsConsentArchive.ConsentArchiveId); - } - /*Violation in unique index or Violation in unique constraint */ - catch (DbUpdateException dbUpdateException) when (dbUpdateException.InnerException is SqlException { Number: 2601 or 2627 } sqlException) - { - logger.LogEntitySetError(sqlException, newInstance, k12ArchiveConsent); - protocol.Append(HandbookReferences - .DbConstraintBroken(sqlException, k12ArchiveConsent) - .WithMessage("Failed to migrate consent archive, target database constraint broken.") - ); - - await kxpContext.DisposeAsync(); - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - } + (var consentArchiveInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(consentArchiveInfo, nameof(consentArchiveInfo)); + + ConsentArchiveInfo.Provider.Set(consentArchiveInfo); + protocol.Success(k12ArchiveConsent, consentArchiveInfo, mapped); + logger.LogEntitySetAction(newInstance, consentArchiveInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentArchiveGuid, + k12ArchiveConsent.ConsentArchiveId, consentArchiveInfo.ConsentArchiveID); } } @@ -179,8 +141,8 @@ private async Task MigrateConsentAgreement(CancellationToken canc await using var kx12Context = await kx12ContextFactory.CreateDbContextAsync(cancellationToken); int index = 0; int indexFull = 0; - var consentAgreementUpdates = new List(); - var consentAgreementNews = new List(); + var consentAgreementUpdates = new List(); + var consentAgreementNews = new List(); int itemsCount = kx12Context.CmsConsentAgreements.Count(); foreach (var k12ConsentAgreement in kx12Context.CmsConsentAgreements) @@ -188,7 +150,7 @@ private async Task MigrateConsentAgreement(CancellationToken canc protocol.FetchedSource(k12ConsentAgreement); logger.LogTrace("Migrating consent agreement with ConsentAgreementGuid {ConsentAgreementGuid}", k12ConsentAgreement.ConsentAgreementGuid); - var kxoConsentAgreement = await kxpContext.CmsConsentAgreements.FirstOrDefaultAsync(consentAgreement => consentAgreement.ConsentAgreementGuid == k12ConsentAgreement.ConsentAgreementGuid, cancellationToken); + var kxoConsentAgreement = ConsentAgreementInfo.Provider.Get().WhereEquals(nameof(ConsentAgreementInfo.ConsentAgreementGuid), k12ConsentAgreement.ConsentAgreementGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsentAgreement); var mapped = consentAgreementMapper.Map(k12ConsentAgreement, kxoConsentAgreement); @@ -196,16 +158,16 @@ private async Task MigrateConsentAgreement(CancellationToken canc if (mapped is { Success: true } result) { - (var cmsConsentAgreement, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsentAgreement, nameof(cmsConsentAgreement)); + (var agreementInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(agreementInfo, nameof(agreementInfo)); if (newInstance) { - consentAgreementNews.Add(cmsConsentAgreement); + consentAgreementNews.Add(agreementInfo); } else { - consentAgreementUpdates.Add(cmsConsentAgreement); + ConsentAgreementInfo.Provider.Set(agreementInfo); } } @@ -214,58 +176,15 @@ private async Task MigrateConsentAgreement(CancellationToken canc if (index == batchSize || indexFull == itemsCount) { - kxpContext.CmsConsentAgreements.AddRange(consentAgreementNews); - kxpContext.CmsConsentAgreements.UpdateRange(consentAgreementUpdates); - try { - await kxpContext.SaveChangesAsync(cancellationToken); - + ConsentAgreementInfo.Provider.BulkInsert(consentAgreementNews); foreach (var newK12ConsentAgreement in consentAgreementNews) { protocol.Success(k12ConsentAgreement, newK12ConsentAgreement, mapped); logger.LogDebug("CmsConsentAgreement: with ConsentAgreementGuid \'{ConsentAgreementGuid}\' was inserted", newK12ConsentAgreement.ConsentAgreementGuid); } - - foreach (var updateK12ConsentAgreement in consentAgreementUpdates) - { - protocol.Success(k12ConsentAgreement, updateK12ConsentAgreement, mapped); - logger.LogDebug("CmsConsentAgreement: with ConsentAgreementGuid \'{ConsentAgreementGuid}\' was updated", - updateK12ConsentAgreement.ConsentAgreementGuid); - } - } - catch (DbUpdateException dbUpdateException) when ( - dbUpdateException.InnerException is SqlException sqlException && - sqlException.Message.Contains("Cannot insert duplicate key row in object") - ) - { - await kxpContext.DisposeAsync(); - - protocol.Append(HandbookReferences - .ErrorCreatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrints(consentAgreementNews) - ); - logger.LogEntitiesSetError(dbUpdateException, true, consentAgreementNews); - - - protocol.Append(HandbookReferences - .ErrorUpdatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrints(consentAgreementUpdates) - ); - - var cai = ConsentAgreementInfo.New(); - protocol.Append(HandbookReferences - .ErrorUpdatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrint(cai) - ); - - logger.LogEntitiesSetError(dbUpdateException, false, consentAgreementUpdates); - - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); } finally { diff --git a/Migration.Tool.Core.KX12/Handlers/MigrateUsersCommandHandler.cs b/Migration.Tool.Core.KX12/Handlers/MigrateUsersCommandHandler.cs index 95989d6b..1b7bed6e 100644 --- a/Migration.Tool.Core.KX12/Handlers/MigrateUsersCommandHandler.cs +++ b/Migration.Tool.Core.KX12/Handlers/MigrateUsersCommandHandler.cs @@ -12,7 +12,6 @@ using Migration.Tool.Core.KX12.Contexts; using Migration.Tool.KX12.Context; using Migration.Tool.KXP.Api.Enums; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Handlers; @@ -193,7 +192,7 @@ private async Task MigrateUserRole(int k12RoleId) if (!primaryKeyMappingContext.TryRequireMapFromSource(u => u.RoleId, k12RoleId, out int xbkRoleId)) { var handbookRef = HandbookReferences - .MissingRequiredDependency(nameof(UserRoleInfo.RoleID), k12UserRole.RoleId) + .MissingRequiredDependency(nameof(UserRoleInfo.RoleID), k12UserRole.RoleId) .NeedsManualAction(); protocol.Append(handbookRef); diff --git a/Migration.Tool.Core.KX12/Helpers/Printer.cs b/Migration.Tool.Core.KX12/Helpers/Printer.cs index 5b078b86..55c0a379 100644 --- a/Migration.Tool.Core.KX12/Helpers/Printer.cs +++ b/Migration.Tool.Core.KX12/Helpers/Printer.cs @@ -1,13 +1,14 @@ +using CMS.ContactManagement; using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; using CMS.Membership; using CMS.Modules; - +using CMS.OnlineForms; using Migration.Tool.Common.Helpers; using Migration.Tool.Common.Services; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Helpers; @@ -19,15 +20,15 @@ public static string PrintKxpModelInfo(T model) return model switch { - MediaLibrary mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGuid)}={mediaLibrary.LibraryGuid}", - MediaFile mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGuid)}={mediaFile.FileGuid}", - CmsRole role => $"{currentTypeName}: {nameof(role.RoleGuid)}={role.RoleGuid}, {nameof(role.RoleName)}={role.RoleName}", - CmsUser user => $"{currentTypeName}: {nameof(user.UserGuid)}={user.UserGuid}, {nameof(user.UserName)}={user.UserName}", - CmsResource resource => $"{currentTypeName}: {nameof(resource.ResourceGuid)}={resource.ResourceGuid}, {nameof(resource.ResourceName)}={resource.ResourceName}", - CmsSettingsCategory settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", - CmsSettingsKey settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGuid)}={settingsKey.KeyGuid}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", - CmsForm form => $"{currentTypeName}: {nameof(form.FormGuid)}={form.FormGuid}, {nameof(form.FormName)}={form.FormName}", - OmContactGroup omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGuid)}={omContactGroup.ContactGroupGuid}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", + MediaLibraryInfo mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGUID)}={mediaLibrary.LibraryGUID}", + MediaFileInfo mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGUID)}={mediaFile.FileGUID}", + RoleInfo role => $"{currentTypeName}: {nameof(role.RoleGUID)}={role.RoleGUID}, {nameof(role.RoleName)}={role.RoleName}", + UserInfo user => $"{currentTypeName}: {nameof(user.UserGUID)}={user.UserGUID}, {nameof(user.UserName)}={user.UserName}", + ResourceInfo resource => $"{currentTypeName}: {nameof(resource.ResourceGUID)}={resource.ResourceGUID}, {nameof(resource.ResourceName)}={resource.ResourceName}", + SettingsCategoryInfo settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", + SettingsKeyInfo settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGUID)}={settingsKey.KeyGUID}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", + BizFormInfo form => $"{currentTypeName}: {nameof(form.FormGUID)}={form.FormGUID}, {nameof(form.FormName)}={form.FormName}", + ContactGroupInfo omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGUID)}={omContactGroup.ContactGroupGUID}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", null => $"{currentTypeName}: ", _ => $"TODO: {typeof(T).FullName}" @@ -61,12 +62,11 @@ string FormatModel(string inner) => printType RoleInfo item => FormatModel($"ID={item.RoleID}, Guid={item.RoleGUID} Name={item.RoleName}"), MemberInfo item => FormatModel($"ID={item.MemberID}, Guid={item.MemberGuid} Name={item.MemberName}"), - CmsForm item => FormatModel($"ID={item.FormId}, GUID={item.FormGuid}, Name={item.FormName}"), - CmsUser item => FormatModel($"ID={item.UserId}, GUID={item.UserGuid}, Name={item.UserName}"), - CmsConsent item => FormatModel($"ID={item.ConsentId}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), - CmsConsentArchive item => FormatModel($"ID={item.ConsentArchiveId}, GUID={item.ConsentArchiveGuid}"), - CmsConsentAgreement item => FormatModel($"ID={item.ConsentAgreementId}, GUID={item.ConsentAgreementGuid}"), - CmsSettingsKey item => FormatModel($"ID={item.KeyId}, GUID={item.KeyGuid}, Name={item.KeyName}"), + BizFormInfo item => FormatModel($"ID={item.FormID}, GUID={item.FormGUID}, Name={item.FormName}"), + ConsentInfo item => FormatModel($"ID={item.ConsentID}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), + ConsentArchiveInfo item => FormatModel($"ID={item.ConsentArchiveID}, GUID={item.ConsentArchiveGuid}"), + ConsentAgreementInfo item => FormatModel($"ID={item.ConsentAgreementID}, GUID={item.ConsentAgreementGuid}"), + SettingsKeyInfo item => FormatModel($"ID={item.KeyID}, GUID={item.KeyGUID}, Name={item.KeyName}"), KX12M.CmsPageTemplateConfiguration item => FormatModel($"ID={item.PageTemplateConfigurationId}, GUID={item.PageTemplateConfigurationGuid}, Name={item.PageTemplateConfigurationName}, SiteId={item.PageTemplateConfigurationSiteId}"), KX12M.CmsRole item => FormatModel($"ID={item.RoleId}, GUID={item.RoleGuid}, Name={item.RoleName}, SiteId={item.SiteId}"), diff --git a/Migration.Tool.Core.KX12/KX12CoreDiExtensions.cs b/Migration.Tool.Core.KX12/KX12CoreDiExtensions.cs index 6f66c580..fa8227a3 100644 --- a/Migration.Tool.Core.KX12/KX12CoreDiExtensions.cs +++ b/Migration.Tool.Core.KX12/KX12CoreDiExtensions.cs @@ -1,4 +1,6 @@ +using CMS.ContactManagement; using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; @@ -18,7 +20,6 @@ using Migration.Tool.Core.KX12.Helpers; using Migration.Tool.Core.KX12.Mappers; using Migration.Tool.Core.KX12.Services; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12; @@ -47,18 +48,17 @@ public static IServiceCollection UseKx12ToolCore(this IServiceCollection service // mappers services.AddTransient, CmsAttachmentMapper>(); - services.AddTransient, CmsConsentMapper>(); - services.AddTransient, CmsConsentAgreementMapper>(); - services.AddTransient, CmsConsentArchiveMapper>(); + services.AddTransient, CmsConsentMapper>(); + services.AddTransient, CmsConsentAgreementMapper>(); + services.AddTransient, CmsConsentArchiveMapper>(); services.AddTransient, AlternativeFormMapper>(); services.AddTransient, RoleInfoMapper>(); - services.AddTransient, CmsSettingsCategoryMapper>(); services.AddTransient, CmsSettingsKeyMapper>(); services.AddTransient, UserInfoMapper>(); services.AddTransient, MemberInfoMapper>(); services.AddTransient, UserRoleInfoMapper>(); - services.AddTransient, OmContactGroupMapper>(); - services.AddTransient, OmContactStatusMapper>(); + services.AddTransient, OmContactGroupMapper>(); + services.AddTransient, OmContactStatusMapper>(); services.AddTransient, CountryInfoMapper>(); services.AddTransient, StateInfoMapper>(); diff --git a/Migration.Tool.Core.KX12/Mappers/CmsConsentAgreementMapper.cs b/Migration.Tool.Core.KX12/Mappers/CmsConsentAgreementMapper.cs index 01e0ea64..d963ebd4 100644 --- a/Migration.Tool.Core.KX12/Mappers/CmsConsentAgreementMapper.cs +++ b/Migration.Tool.Core.KX12/Mappers/CmsConsentAgreementMapper.cs @@ -1,21 +1,21 @@ +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Mappers; -public class CmsConsentAgreementMapper : EntityMapperBase +public class CmsConsentAgreementMapper : EntityMapperBase { public CmsConsentAgreementMapper(ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) : base(logger, primaryKeyMappingContext, protocol) { } - protected override CmsConsentAgreement? CreateNewInstance(KX12M.CmsConsentAgreement source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentAgreementInfo? CreateNewInstance(KX12M.CmsConsentAgreement source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override CmsConsentAgreement MapInternal(KX12M.CmsConsentAgreement source, CmsConsentAgreement target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + protected override ConsentAgreementInfo MapInternal(KX12M.CmsConsentAgreement source, ConsentAgreementInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentAgreementGuid = source.ConsentAgreementGuid; target.ConsentAgreementRevoked = source.ConsentAgreementRevoked; @@ -24,12 +24,12 @@ protected override CmsConsentAgreement MapInternal(KX12M.CmsConsentAgreement sou if (mappingHelper.TranslateRequiredId(c => c.ContactId, source.ConsentAgreementContactId, out int contactId)) { - target.ConsentAgreementContactId = contactId; + target.ConsentAgreementContactID = contactId; } if (mappingHelper.TranslateRequiredId(r => r.ConsentId, source.ConsentAgreementConsentId, out int consentId)) { - target.ConsentAgreementConsentId = consentId; + target.ConsentAgreementConsentID = consentId; } return target; diff --git a/Migration.Tool.Core.KX12/Mappers/CmsConsentArchiveMapper.cs b/Migration.Tool.Core.KX12/Mappers/CmsConsentArchiveMapper.cs index 3584e510..b4e02674 100644 --- a/Migration.Tool.Core.KX12/Mappers/CmsConsentArchiveMapper.cs +++ b/Migration.Tool.Core.KX12/Mappers/CmsConsentArchiveMapper.cs @@ -1,22 +1,22 @@ +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Mappers; -public class CmsConsentArchiveMapper : EntityMapperBase +public class CmsConsentArchiveMapper : EntityMapperBase { public CmsConsentArchiveMapper(ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) : base(logger, primaryKeyMappingContext, protocol) { } - protected override CmsConsentArchive? CreateNewInstance(KX12M.CmsConsentArchive source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentArchiveInfo? CreateNewInstance(KX12M.CmsConsentArchive source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override CmsConsentArchive MapInternal(KX12M.CmsConsentArchive source, CmsConsentArchive target, bool newInstance, + protected override ConsentArchiveInfo MapInternal(KX12M.CmsConsentArchive source, ConsentArchiveInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentArchiveContent = source.ConsentArchiveContent; @@ -26,7 +26,7 @@ protected override CmsConsentArchive MapInternal(KX12M.CmsConsentArchive source, if (mappingHelper.TranslateRequiredId(r => r.ConsentId, source.ConsentArchiveConsentId, out int consentId)) { - target.ConsentArchiveConsentId = consentId; + target.ConsentArchiveConsentID = consentId; } return target; diff --git a/Migration.Tool.Core.KX12/Mappers/CmsConsentMapper.cs b/Migration.Tool.Core.KX12/Mappers/CmsConsentMapper.cs index 4a535b80..e758d4e3 100644 --- a/Migration.Tool.Core.KX12/Mappers/CmsConsentMapper.cs +++ b/Migration.Tool.Core.KX12/Mappers/CmsConsentMapper.cs @@ -3,25 +3,24 @@ using System.Xml.XPath; using CMS.ContentEngine; - +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Mappers; -public class CmsConsentMapper : EntityMapperBase +public class CmsConsentMapper : EntityMapperBase { public CmsConsentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) { } - protected override CmsConsent? CreateNewInstance(KX12M.CmsConsent source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentInfo? CreateNewInstance(KX12M.CmsConsent source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override CmsConsent MapInternal(KX12M.CmsConsent source, CmsConsent target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + protected override ConsentInfo MapInternal(KX12M.CmsConsent source, ConsentInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentDisplayName = source.ConsentDisplayName; var defaultContentLanguageInfo = ContentLanguageInfo.Provider.Get().WhereEquals(nameof(ContentLanguageInfo.ContentLanguageIsDefault), true).FirstOrDefault() ?? throw new InvalidCastException("Missing default content language"); @@ -29,7 +28,7 @@ protected override CmsConsent MapInternal(KX12M.CmsConsent source, CmsConsent ta target.ConsentContent = ConsentContentPatcher.PatchConsentContent(source.ConsentContent, defaultContentLanguageInfo); target.ConsentGuid = source.ConsentGuid; target.ConsentLastModified = source.ConsentLastModified; - target.ConsentHash = source.ConsentHash; + target.SetValue(nameof(target.ConsentHash), source.ConsentHash); return target; } diff --git a/Migration.Tool.Core.KX12/Mappers/CmsFormMapper.cs b/Migration.Tool.Core.KX12/Mappers/CmsFormMapper.cs index 49c6ab48..f852d4ce 100644 --- a/Migration.Tool.Core.KX12/Mappers/CmsFormMapper.cs +++ b/Migration.Tool.Core.KX12/Mappers/CmsFormMapper.cs @@ -7,7 +7,6 @@ using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Mappers; @@ -49,43 +48,3 @@ protected override BizFormInfo MapInternal(KX12M.CmsForm source, BizFormInfo tar return target; } } - -public class CmsFormMapperEf : EntityMapperBase -{ - public CmsFormMapperEf(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) - { - } - - protected override CmsForm? CreateNewInstance(KX12M.CmsForm source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override CmsForm MapInternal(KX12M.CmsForm source, CmsForm target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - target.FormDisplayName = source.FormDisplayName; - target.FormName = source.FormName; - // target.FormSendToEmail = source.FormSendToEmail; - // target.FormSendFromEmail = source.FormSendFromEmail; - // target.FormEmailSubject = source.FormEmailSubject; - // target.FormEmailTemplate = source.FormEmailTemplate; - // target.FormEmailAttachUploadedDocs = source.FormEmailAttachUploadedDocs; - target.FormItems = source.FormItems; - target.FormReportFields = source.FormReportFields; - target.FormSubmitButtonText = source.FormSubmitButtonText; - // target.FormConfirmationEmailField = source.FormConfirmationEmailField; - // target.FormConfirmationTemplate = source.FormConfirmationTemplate; - // target.FormConfirmationSendFromEmail = source.FormConfirmationSendFromEmail; - // target.FormConfirmationEmailSubject = source.FormConfirmationEmailSubject; - target.FormAccess = source.FormAccess; - target.FormSubmitButtonImage = source.FormSubmitButtonImage; - target.FormGuid = source.FormGuid; - target.FormLastModified = source.FormLastModified; - target.FormLogActivity = source.FormLogActivity ?? false; - target.FormBuilderLayout = source.FormBuilderLayout; - - if (mappingHelper.TranslateRequiredId(c => c.ClassId, source.FormClassId, out int classId)) - { - target.FormClassId = classId; - } - - return target; - } -} diff --git a/Migration.Tool.Core.KX12/Mappers/CmsSettingsCategoryMapper.cs b/Migration.Tool.Core.KX12/Mappers/CmsSettingsCategoryMapper.cs deleted file mode 100644 index 37301232..00000000 --- a/Migration.Tool.Core.KX12/Mappers/CmsSettingsCategoryMapper.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; - -namespace Migration.Tool.Core.KX12.Mappers; - -public class CmsSettingsCategoryMapper( - ILogger logger, - PrimaryKeyMappingContext pkContext, - IProtocol protocol, - IEntityMapper cmsResourceMapper) - : EntityMapperBase(logger, pkContext, protocol) -{ - protected override CmsSettingsCategory? CreateNewInstance(KX12M.CmsSettingsCategory source, MappingHelper mappingHelper, - AddFailure addFailure) => new(); - - - protected override CmsSettingsCategory MapInternal(KX12M.CmsSettingsCategory source, CmsSettingsCategory target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - // no category guid to match on... - if (newInstance) - { - target.CategoryOrder = source.CategoryOrder; - target.CategoryName = source.CategoryName; - target.CategoryDisplayName = source.CategoryDisplayName; - target.CategoryIdpath = source.CategoryIdpath; - target.CategoryLevel = source.CategoryLevel; - target.CategoryChildCount = source.CategoryChildCount; - target.CategoryIconPath = source.CategoryIconPath; - target.CategoryIsGroup = source.CategoryIsGroup; - target.CategoryIsCustom = source.CategoryIsCustom; - } - - if (source.CategoryResource != null) - { - if (target.CategoryResource != null && source.CategoryResourceId != null && target.CategoryResourceId != null) - { - // skip if target is present - logger.LogTrace("Skipping category resource '{ResourceGuid}', already present in target instance", target.CategoryResource.ResourceGuid); - pkContext.SetMapping(r => r.ResourceId, source.CategoryResourceId.Value, target.CategoryResourceId.Value); - } - else - { - switch (cmsResourceMapper.Map(source.CategoryResource, target.CategoryResource)) - { - case { Success: true } result: - { - target.CategoryResource = result.Item; - break; - } - case { Success: false } result: - { - addFailure(new MapperResultFailure(result.HandbookReference)); - break; - } - - default: - break; - } - } - } - else if (mappingHelper.TranslateIdAllowNulls(r => r.ResourceId, source.CategoryResourceId, out int? categoryResourceId)) - { - target.CategoryResourceId = categoryResourceId; - } - - if (source.CategoryParent != null) - { - switch (Map(source.CategoryParent, target.CategoryParent)) - { - case { Success: true } result: - { - target.CategoryParent = result.Item; - break; - } - case { Success: false } result: - { - addFailure(new MapperResultFailure(result.HandbookReference)); - break; - } - - default: - break; - } - } - else if (mappingHelper.TranslateIdAllowNulls(c => c.CategoryId, source.CategoryParentId, out int? categoryParentId)) - { - target.CategoryParentId = categoryParentId; - } - - return target; - } -} diff --git a/Migration.Tool.Core.KX12/Mappers/CmsUserMapper.cs b/Migration.Tool.Core.KX12/Mappers/CmsUserMapper.cs deleted file mode 100644 index bc28f2ce..00000000 --- a/Migration.Tool.Core.KX12/Mappers/CmsUserMapper.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; - -namespace Migration.Tool.Core.KX12.Mappers; - -public class CmsUserMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol) : EntityMapperBase(logger, primaryKeyMappingContext, protocol) -{ - protected override CmsUser CreateNewInstance(KX12M.CmsUser tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override CmsUser MapInternal(KX12M.CmsUser source, CmsUser target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - if (!newInstance && source.UserGuid != target.UserGuid) - { - // assertion failed - logger.LogTrace("Assertion failed, entity key mismatch"); - throw new InvalidOperationException("Assertion failed, entity key mismatch."); - } - - target.UserName = source.UserName; - target.FirstName = source.FirstName; - target.LastName = source.LastName; - target.Email = source.Email; - target.UserPassword = source.UserPassword; - target.UserEnabled = source.UserEnabled; - target.UserCreated = source.UserCreated; - target.LastLogon = source.LastLogon; - target.UserGuid = source.UserGuid; - target.UserLastModified = source.UserLastModified; - target.UserSecurityStamp = source.UserSecurityStamp; - target.UserAdministrationAccess = source.UserPrivilegeLevel == 3; - target.UserIsPendingRegistration = false; - target.UserPasswordLastChanged = null; - target.UserRegistrationLinkExpiration = DateTime.Now.AddDays(365); - - foreach (var sourceCmsUserRole in source.CmsUserRoles) - { - if (mappingHelper.TranslateRequiredId(r => r.RoleId, sourceCmsUserRole.RoleId, out int targetRoleId)) - { - if (target.CmsUserRoles.All(x => x.RoleId != targetRoleId)) - { - target.CmsUserRoles.Add(new CmsUserRole { RoleId = targetRoleId, User = target }); - } - } - } - - return target; - } -} diff --git a/Migration.Tool.Core.KX12/Mappers/OmContactGroupMapper.cs b/Migration.Tool.Core.KX12/Mappers/OmContactGroupMapper.cs index c7a5d0c4..2b51e2a0 100644 --- a/Migration.Tool.Core.KX12/Mappers/OmContactGroupMapper.cs +++ b/Migration.Tool.Core.KX12/Mappers/OmContactGroupMapper.cs @@ -1,13 +1,14 @@ +using CMS.ContactManagement; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; +using Migration.Tool.KX12.Models; namespace Migration.Tool.Core.KX12.Mappers; -public class OmContactGroupMapper : EntityMapperBase +public class OmContactGroupMapper : EntityMapperBase { public OmContactGroupMapper( ILogger logger, @@ -17,19 +18,36 @@ IProtocol protocol { } - protected override OmContactGroup? CreateNewInstance(KX12M.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ContactGroupInfo? CreateNewInstance(OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override OmContactGroup MapInternal(KX12M.OmContactGroup source, OmContactGroup target, bool newInstance, + protected override ContactGroupInfo MapInternal(OmContactGroup source, ContactGroupInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { + T RequireValue(string propertyName, T? value, T defaultValue) where T : struct + { + if (value.HasValue) + { + return value.Value; + } + else + { + addFailure(new MapperResultFailure( + HandbookReferences.InvalidSourceData() + .WithMessage("Required property value is null") + .WithId(nameof(source.ContactGroupId), source.ContactGroupId) + .WithData(new { MissingProperty = propertyName }))); + return defaultValue; + } + } + target.ContactGroupName = source.ContactGroupName; target.ContactGroupDisplayName = source.ContactGroupDisplayName; target.ContactGroupDescription = source.ContactGroupDescription; target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; - target.ContactGroupEnabled = source.ContactGroupEnabled; - target.ContactGroupLastModified = source.ContactGroupLastModified; - target.ContactGroupGuid = source.ContactGroupGuid; - target.ContactGroupStatus = source.ContactGroupStatus; + target.ContactGroupEnabled = RequireValue(nameof(source.ContactGroupEnabled), source.ContactGroupEnabled, false); + target.ContactGroupLastModified = RequireValue(nameof(source.ContactGroupLastModified), source.ContactGroupLastModified, DateTime.MinValue); + target.ContactGroupGUID = RequireValue(nameof(source.ContactGroupGuid), source.ContactGroupGuid, Guid.Empty); + target.ContactGroupStatus = (ContactGroupStatusEnum)RequireValue(nameof(source.ContactGroupStatus), source.ContactGroupStatus, 0); return target; } diff --git a/Migration.Tool.Core.KX12/Mappers/OmContactStatusMapper.cs b/Migration.Tool.Core.KX12/Mappers/OmContactStatusMapper.cs index 4641323b..4d3716f4 100644 --- a/Migration.Tool.Core.KX12/Mappers/OmContactStatusMapper.cs +++ b/Migration.Tool.Core.KX12/Mappers/OmContactStatusMapper.cs @@ -1,13 +1,13 @@ +using CMS.ContactManagement; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX12.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX12.Mappers; -public class OmContactStatusMapper : EntityMapperBase +public class OmContactStatusMapper : EntityMapperBase { public OmContactStatusMapper( ILogger logger, @@ -17,10 +17,10 @@ IProtocol protocol { } - protected override OmContactStatus? CreateNewInstance(KX12M.OmContactStatus tSourceEntity, MappingHelper mappingHelper, + protected override ContactStatusInfo? CreateNewInstance(KX12M.OmContactStatus tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override OmContactStatus MapInternal(KX12M.OmContactStatus source, OmContactStatus target, bool newInstance, + protected override ContactStatusInfo MapInternal(KX12M.OmContactStatus source, ContactStatusInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ContactStatusName = source.ContactStatusName; diff --git a/Migration.Tool.Core.KX12/Migration.Tool.Core.KX12.csproj b/Migration.Tool.Core.KX12/Migration.Tool.Core.KX12.csproj index de13157e..e5d76a5b 100644 --- a/Migration.Tool.Core.KX12/Migration.Tool.Core.KX12.csproj +++ b/Migration.Tool.Core.KX12/Migration.Tool.Core.KX12.csproj @@ -1,15 +1,14 @@ - - - - + + + - + diff --git a/Migration.Tool.Core.KX12/Services/KeyLocatorService.cs b/Migration.Tool.Core.KX12/Services/KeyLocatorService.cs index d8ff02d0..5a876387 100644 --- a/Migration.Tool.Core.KX12/Services/KeyLocatorService.cs +++ b/Migration.Tool.Core.KX12/Services/KeyLocatorService.cs @@ -5,24 +5,21 @@ using Microsoft.Extensions.Logging; using Migration.Tool.KX12.Context; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.KX12.Services; public class KeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory kx12ContextFactory) { public bool TryLocate( Expression> sourceKeySelector, - Expression> targetKeySelector, + Func targetKeySelector, Expression> sourceGuidSelector, - Expression> targetGuidSelector, + Func targetByGuidProvider, object? sourceKey, out TTargetKey targetId ) where TSource : class where TTarget : class { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var kx12Context = kx12ContextFactory.CreateDbContext(); var sourceType = typeof(TSource); @@ -42,17 +39,14 @@ public bool TryLocate( var sourcePredicate = Expression.Lambda>(sourceEquals, sourceKeySelector.Parameters[0]); var k12Guid = kx12Context.Set().Where(sourcePredicate).Select(sourceGuidSelector).Single(); - var param = Expression.Parameter(typeof(TTarget), "t"); - var member = targetGuidSelector.Body as MemberExpression ?? throw new InvalidOperationException($"Expression SHALL NOT be other than member expression, expression: {targetGuidSelector}"); - var targetEquals = Expression.Equal( - Expression.MakeMemberAccess(param, member.Member), - Expression.Constant(k12Guid, typeof(Guid)) - ); - var targetPredicate = Expression.Lambda>(targetEquals, param); + var target = targetByGuidProvider(k12Guid); + if (target is null) + { + logger.LogWarning("Mapping {SourceFullType} primary key: {SourceId} failed, GUID {TargetGUID} not present in target instance", sourceType.FullName, sourceKey, k12Guid); + return false; + } - var query = kxpContext.Set().Where(targetPredicate); - var selector = Expression.Lambda>(targetKeySelector.Body, targetKeySelector.Parameters[0]); - targetId = query.Select(selector).Single(); + targetId = targetKeySelector(target); return true; } catch (InvalidOperationException ioex) diff --git a/Migration.Tool.Core.KX12/Services/PrimaryKeyLocatorService.cs b/Migration.Tool.Core.KX12/Services/PrimaryKeyLocatorService.cs index da4cc988..b6b2edfe 100644 --- a/Migration.Tool.Core.KX12/Services/PrimaryKeyLocatorService.cs +++ b/Migration.Tool.Core.KX12/Services/PrimaryKeyLocatorService.cs @@ -1,23 +1,25 @@ using System.Linq.Expressions; - +using CMS.ContactManagement; +using CMS.ContentEngine; +using CMS.DataEngine; +using CMS.Globalization; +using CMS.Membership; +using CMS.Modules; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; using Migration.Tool.KX12.Context; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.KX12.Services; public class PrimaryKeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory kx12ContextFactory) : IPrimaryKeyLocatorService { public IEnumerable SelectAll(Expression> keyNameSelector) { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var kx12Context = kx12ContextFactory.CreateDbContext(); var sourceType = typeof(T); @@ -28,12 +30,12 @@ public IEnumerable SelectAll(Expression new { x.UserId, x.UserGuid, x.UserName }).ToList(); - var targetUsers = kxpContext.CmsUsers.Select(x => new { x.UserId, x.UserName, x.UserGuid }).ToList(); + var targetUsers = UserInfo.Provider.Get().Select(x => new { x.UserID, x.UserName, x.UserGUID }).ToList(); var result = sourceUsers.Join(targetUsers, a => new CmsUserKey(a.UserGuid, a.UserName), - b => new CmsUserKey(b.UserGuid, b.UserName), - (a, b) => new SourceTargetKeyMapping(a.UserId, b.UserId), + b => new CmsUserKey(b.UserGUID, b.UserName), + (a, b) => new SourceTargetKeyMapping(a.UserId, b.UserID), new KeyEqualityComparerWithLambda((ak, bk) => (ak?.UserGuid == bk?.UserGuid || ak?.UserName == bk?.UserName) && ak != null && bk != null) ); @@ -50,14 +52,14 @@ public IEnumerable SelectAll(Expression c.ContactCreated) .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); - var target = kxpContext.OmContacts - .OrderBy(c => c.ContactCreated) - .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); + var target = ContactInfo.Provider.Get() + .OrderBy(nameof(ContactInfo.ContactCreated)) + .Select(x => new { x.ContactID, x.ContactGUID }).ToList(); var result = source.Join(target, a => a.ContactGuid, - b => b.ContactGuid, - (a, b) => new SourceTargetKeyMapping(a.ContactId, b.ContactId) + b => b.ContactGUID, + (a, b) => new SourceTargetKeyMapping(a.ContactId, b.ContactID) ); foreach (var resultingMapping in result) @@ -71,12 +73,12 @@ public IEnumerable SelectAll(Expression new { x.StateId, x.StateName }).ToList(); - var target = kxpContext.CmsStates.Select(x => new { x.StateId, x.StateName }).ToList(); + var target = StateInfo.Provider.Get().Select(x => new { x.StateID, x.StateName }).ToList(); var result = source.Join(target, a => a.StateName, b => b.StateName, - (a, b) => new SourceTargetKeyMapping(a.StateId, b.StateId) + (a, b) => new SourceTargetKeyMapping(a.StateId, b.StateID) ); foreach (var resultingMapping in result) @@ -90,12 +92,12 @@ public IEnumerable SelectAll(Expression new { x.CountryId, x.CountryName }).ToList(); - var target = kxpContext.CmsCountries.Select(x => new { x.CountryId, x.CountryName }).ToList(); + var target = CountryInfo.Provider.Get().Select(x => new { x.CountryID, x.CountryName }).ToList(); var result = source.Join(target, a => a.CountryName, b => b.CountryName, - (a, b) => new SourceTargetKeyMapping(a.CountryId, b.CountryId) + (a, b) => new SourceTargetKeyMapping(a.CountryId, b.CountryID) ); foreach (var resultingMapping in result) @@ -112,7 +114,6 @@ public IEnumerable SelectAll(Expression(Expression> keyNameSelector, int sourceId, out int targetId) { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var KX12Context = kx12ContextFactory.CreateDbContext(); var sourceType = typeof(T); @@ -122,63 +123,62 @@ public bool TryLocate(Expression> keyNameSelector, int source if (sourceType == typeof(KX12M.CmsResource)) { var k12Guid = KX12Context.CmsResources.Where(c => c.ResourceId == sourceId).Select(x => x.ResourceGuid).Single(); - targetId = kxpContext.CmsResources.Where(x => x.ResourceGuid == k12Guid).Select(x => x.ResourceId).Single(); + targetId = ResourceInfo.Provider.Get().WhereEquals(nameof(ResourceInfo.ResourceGUID), k12Guid).Select(x => x.ResourceID).Single(); return true; } if (sourceType == typeof(KX12M.CmsClass)) { var k12Guid = KX12Context.CmsClasses.Where(c => c.ClassId == sourceId).Select(x => x.ClassGuid).Single(); - targetId = kxpContext.CmsClasses.Where(x => x.ClassGuid == k12Guid).Select(x => x.ClassId).Single(); - return true; + targetId = DataClassInfoProvider.GetClasses().Where(x => x.ClassGUID == k12Guid).Select(x => x.ClassID).Single(); } if (sourceType == typeof(KX12M.CmsUser)) { var k12User = KX12Context.CmsUsers.Where(c => c.UserId == sourceId).Select(x => new { x.UserGuid, x.UserName }).Single(); - targetId = kxpContext.CmsUsers.Where(x => x.UserGuid == k12User.UserGuid || x.UserName == k12User.UserName).Select(x => x.UserId).Single(); + targetId = UserInfo.Provider.Get().WhereEquals(nameof(UserInfo.UserGUID), k12User.UserGuid).Or().WhereEquals(nameof(UserInfo.UserName), k12User.UserName).Select(x => x.UserID).Single(); return true; } if (sourceType == typeof(KX12M.CmsRole)) { var k12User = KX12Context.CmsRoles.Where(c => c.RoleId == sourceId).Select(x => new { x.RoleGuid }).Single(); - targetId = kxpContext.CmsRoles.Where(x => x.RoleGuid == k12User.RoleGuid).Select(x => x.RoleId).Single(); + targetId = RoleInfo.Provider.Get().WhereEquals(nameof(RoleInfo.RoleGUID), k12User.RoleGuid).Select(x => x.RoleID).Single(); return true; } if (sourceType == typeof(KX12M.CmsSite)) { var k12Guid = KX12Context.CmsSites.Where(c => c.SiteId == sourceId).Select(x => x.SiteGuid).Single(); - targetId = kxpContext.CmsChannels.Where(x => x.ChannelGuid == k12Guid).Select(x => x.ChannelId).Single(); + targetId = ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), k12Guid).Select(x => x.ChannelID).Single(); return true; } if (sourceType == typeof(KX12M.CmsState)) { - string k12CodeName = KX12Context.CmsStates.Where(c => c.StateId == sourceId).Select(x => x.StateName).Single(); - targetId = kxpContext.CmsStates.Where(x => x.StateName == k12CodeName).Select(x => x.StateId).Single(); + string stateName = KX12Context.CmsStates.Where(c => c.StateId == sourceId).Select(x => x.StateName).Single(); + targetId = StateInfo.Provider.Get().WhereEquals(nameof(StateInfo.StateName), stateName).Select(x => x.StateID).Single(); return true; } if (sourceType == typeof(KX12M.CmsCountry)) { - string k12CodeName = KX12Context.CmsCountries.Where(c => c.CountryId == sourceId).Select(x => x.CountryName).Single(); - targetId = kxpContext.CmsCountries.Where(x => x.CountryName == k12CodeName).Select(x => x.CountryId).Single(); + string countryName = KX12Context.CmsCountries.Where(c => c.CountryId == sourceId).Select(x => x.CountryName).Single(); + targetId = CountryInfo.Provider.Get().WhereEquals(nameof(CountryInfo.CountryName), countryName).Select(x => x.CountryID).Single(); return true; } if (sourceType == typeof(KX12M.OmContactStatus)) { - string k12Guid = KX12Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); - targetId = kxpContext.OmContactStatuses.Where(x => x.ContactStatusName == k12Guid).Select(x => x.ContactStatusId).Single(); + string statusName = KX12Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); + targetId = ContactStatusInfo.Provider.Get().WhereEquals(nameof(ContactStatusInfo.ContactStatusName), statusName).Select(x => x.ContactStatusID).Single(); return true; } if (sourceType == typeof(KX12M.OmContact)) { - var k12Guid = KX12Context.OmContacts.Where(c => c.ContactId == sourceId).Select(x => x.ContactGuid).Single(); - targetId = kxpContext.OmContacts.Where(x => x.ContactGuid == k12Guid).Select(x => x.ContactId).Single(); + var contactGuid = KX12Context.OmContacts.Where(c => c.ContactId == sourceId).Select(x => x.ContactGuid).Single(); + targetId = ContactInfo.Provider.Get().WhereEquals(nameof(ContactInfo.ContactGUID), contactGuid).Select(x => x.ContactID).Single(); return true; } } From dc3b3675cd1f6db83762eef08f8ce4cdabd2b237 Mon Sep 17 00:00:00 2001 From: akfakmot Date: Fri, 15 Nov 2024 19:20:11 +0100 Subject: [PATCH 08/10] Remove dependencies of Migration.Tool.Core.KX13 on Migration.Tool.KXP Refactor: Remove dependencies of Migration.Tool.Core.KX13 on Migration.Tool.KXP --- .../Contexts/KeyMappingContext.cs | 6 +- .../DependencyInjectionExtensions.cs | 14 +- .../MigrateContactManagementCommandHandler.cs | 141 +++++++------- .../MigrateDataProtectionCommandHandler.cs | 175 +++++------------- .../Handlers/MigrateUsersCommandHandler.cs | 3 +- Migration.Tool.Core.KX13/Helpers/Printer.cs | 34 ++-- .../Mappers/CmsConsentAgreementMapper.cs | 12 +- .../Mappers/CmsConsentArchiveMapper.cs | 10 +- .../Mappers/CmsConsentMapper.cs | 11 +- .../Mappers/CmsSettingsCategoryMapper.cs | 97 ---------- .../Mappers/CmsUserMapper.cs | 55 ------ .../Mappers/OmContactGroupMapper.cs | 33 +++- .../Mappers/OmContactStatusMapper.cs | 8 +- .../Migration.Tool.Core.KX13.csproj | 1 - .../Services/KeyLocatorService.cs | 24 +-- .../Services/PrimaryKeyLocatorService.cs | 61 +++--- 16 files changed, 227 insertions(+), 458 deletions(-) delete mode 100644 Migration.Tool.Core.KX13/Mappers/CmsSettingsCategoryMapper.cs delete mode 100644 Migration.Tool.Core.KX13/Mappers/CmsUserMapper.cs diff --git a/Migration.Tool.Core.KX13/Contexts/KeyMappingContext.cs b/Migration.Tool.Core.KX13/Contexts/KeyMappingContext.cs index 977c7666..b1692160 100644 --- a/Migration.Tool.Core.KX13/Contexts/KeyMappingContext.cs +++ b/Migration.Tool.Core.KX13/Contexts/KeyMappingContext.cs @@ -11,15 +11,15 @@ public class KeyMappingContext(PrimaryKeyMappingContext primaryKeyMappingContext public MapSourceKeyResult MapSourceKey(Expression> sourceKeySelector, Expression> sourceGuidSelector, object? sourceKey, - Expression> targetKeySelector, - Expression> targetGuidSelector) where TSource : class where TTarget : class + Func targetKeySelector, + Func 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(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(true, located); } diff --git a/Migration.Tool.Core.KX13/DependencyInjectionExtensions.cs b/Migration.Tool.Core.KX13/DependencyInjectionExtensions.cs index 73037bda..9eb0e244 100644 --- a/Migration.Tool.Core.KX13/DependencyInjectionExtensions.cs +++ b/Migration.Tool.Core.KX13/DependencyInjectionExtensions.cs @@ -1,4 +1,6 @@ +using CMS.ContactManagement; using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; @@ -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; @@ -47,18 +48,17 @@ public static IServiceCollection UseKx13ToolCore(this IServiceCollection service // mappers services.AddTransient, CmsAttachmentMapper>(); - services.AddTransient, CmsConsentMapper>(); - services.AddTransient, CmsConsentAgreementMapper>(); - services.AddTransient, CmsConsentArchiveMapper>(); + services.AddTransient, CmsConsentMapper>(); + services.AddTransient, CmsConsentAgreementMapper>(); + services.AddTransient, CmsConsentArchiveMapper>(); services.AddTransient, AlternativeFormMapper>(); services.AddTransient, RoleInfoMapper>(); - services.AddTransient, CmsSettingsCategoryMapper>(); services.AddTransient, CmsSettingsKeyMapper>(); services.AddTransient, UserInfoMapper>(); services.AddTransient, MemberInfoMapper>(); services.AddTransient, UserRoleInfoMapper>(); - services.AddTransient, OmContactGroupMapper>(); - services.AddTransient, OmContactStatusMapper>(); + services.AddTransient, OmContactGroupMapper>(); + services.AddTransient, OmContactStatusMapper>(); services.AddTransient, CountryInfoMapper>(); services.AddTransient, StateInfoMapper>(); diff --git a/Migration.Tool.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs b/Migration.Tool.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs index 9a420b6c..d99d2761 100644 --- a/Migration.Tool.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs +++ b/Migration.Tool.Core.KX13/Handlers/MigrateContactManagementCommandHandler.cs @@ -1,10 +1,10 @@ using CMS.Activities; using CMS.ContactManagement; using CMS.ContentEngine; - +using CMS.Globalization; +using CMS.Membership; using MediatR; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; @@ -16,14 +16,11 @@ using Migration.Tool.Core.KX13.Helpers; using Migration.Tool.Core.KX13.Services; using Migration.Tool.KXP.Api; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Handlers; public class MigrateContactManagementCommandHandler( ILogger logger, - IDbContextFactory kxpContextFactory, BulkDataCopyService bulkDataCopyService, ToolConfiguration toolConfiguration, PrimaryKeyMappingContext primaryKeyMappingContext, @@ -32,12 +29,8 @@ public class MigrateContactManagementCommandHandler( KxpClassFacade kxpClassFacade, ISpoiledGuidContext spoiledGuidContext, IProtocol protocol) - : IRequestHandler, IDisposable + : IRequestHandler { - private readonly KxpContext kxpContext = kxpContextFactory.CreateDbContext(); - - public void Dispose() => kxpContext.Dispose(); - public Task Handle(MigrateContactManagementCommand request, CancellationToken cancellationToken) { countryMigrator.MigrateCountriesAndStates(); @@ -61,36 +54,36 @@ public Task Handle(MigrateContactManagementCommand request, Cance { var requiredColumnsForContactMigration = new Dictionary { - { nameof(KX13M.OmContact.ContactId), nameof(OmContact.ContactId) }, - { nameof(KX13M.OmContact.ContactFirstName), nameof(OmContact.ContactFirstName) }, - { nameof(KX13M.OmContact.ContactMiddleName), nameof(OmContact.ContactMiddleName) }, - { nameof(KX13M.OmContact.ContactLastName), nameof(OmContact.ContactLastName) }, - { nameof(KX13M.OmContact.ContactJobTitle), nameof(OmContact.ContactJobTitle) }, - { nameof(KX13M.OmContact.ContactAddress1), nameof(OmContact.ContactAddress1) }, - { nameof(KX13M.OmContact.ContactCity), nameof(OmContact.ContactCity) }, - { nameof(KX13M.OmContact.ContactZip), nameof(OmContact.ContactZip) }, - { nameof(KX13M.OmContact.ContactStateId), nameof(OmContact.ContactStateId) }, - { nameof(KX13M.OmContact.ContactCountryId), nameof(OmContact.ContactCountryId) }, - { nameof(KX13M.OmContact.ContactMobilePhone), nameof(OmContact.ContactMobilePhone) }, - { nameof(KX13M.OmContact.ContactBusinessPhone), nameof(OmContact.ContactBusinessPhone) }, - { nameof(KX13M.OmContact.ContactEmail), nameof(OmContact.ContactEmail) }, - // No support 2022-07-07 { nameof(OmContact.ContactBirthday), nameof(KXO.Models.OmContact.ContactBirthday) }, - { nameof(KX13M.OmContact.ContactGender), nameof(OmContact.ContactGender) }, - // { nameof(OmContact.ContactStatusId), nameof(KXO.Models.OmContact.ContactStatusId) }, // No support 2022-07-07 but needs to be mapped because of constraint - { nameof(KX13M.OmContact.ContactNotes), nameof(OmContact.ContactNotes) }, - { nameof(KX13M.OmContact.ContactOwnerUserId), nameof(OmContact.ContactOwnerUserId) }, - // No support 2022-07-07 { nameof(OmContact.ContactMonitored), nameof(KXO.Models.OmContact.ContactMonitored) }, - { nameof(KX13M.OmContact.ContactGuid), nameof(OmContact.ContactGuid) }, - { nameof(KX13M.OmContact.ContactLastModified), nameof(OmContact.ContactLastModified) }, - { nameof(KX13M.OmContact.ContactCreated), nameof(OmContact.ContactCreated) }, - // No support 2022-07-07 { nameof(OmContact.ContactBounces), nameof(KXO.Models.OmContact.ContactBounces) }, - { nameof(KX13M.OmContact.ContactCampaign), nameof(OmContact.ContactCampaign) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadId), nameof(KXO.Models.OmContact.ContactSalesForceLeadId) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationDisabled), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDisabled) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDateTime) }, - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationSuspensionDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationSuspensionDateTime) }, - { nameof(KX13M.OmContact.ContactCompanyName), nameof(OmContact.ContactCompanyName) } - // No support 2022-07-07 { nameof(OmContact.ContactSalesForceLeadReplicationRequired), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationRequired) }, + { nameof(KX13M.OmContact.ContactId), nameof(ContactInfo.ContactID) }, + { nameof(KX13M.OmContact.ContactFirstName), nameof(ContactInfo.ContactFirstName) }, + { nameof(KX13M.OmContact.ContactMiddleName), nameof(ContactInfo.ContactMiddleName) }, + { nameof(KX13M.OmContact.ContactLastName), nameof(ContactInfo.ContactLastName) }, + { nameof(KX13M.OmContact.ContactJobTitle), nameof(ContactInfo.ContactJobTitle) }, + { nameof(KX13M.OmContact.ContactAddress1), nameof(ContactInfo.ContactAddress1) }, + { nameof(KX13M.OmContact.ContactCity), nameof(ContactInfo.ContactCity) }, + { nameof(KX13M.OmContact.ContactZip), nameof(ContactInfo.ContactZIP) }, + { nameof(KX13M.OmContact.ContactStateId), nameof(ContactInfo.ContactStateID) }, + { nameof(KX13M.OmContact.ContactCountryId), nameof(ContactInfo.ContactCountryID) }, + { nameof(KX13M.OmContact.ContactMobilePhone), nameof(ContactInfo.ContactMobilePhone) }, + { nameof(KX13M.OmContact.ContactBusinessPhone), nameof(ContactInfo.ContactBusinessPhone) }, + { nameof(KX13M.OmContact.ContactEmail), nameof(ContactInfo.ContactEmail) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactBirthday), nameof(KXO.Models.OmContact.ContactBirthday) }, + { nameof(KX13M.OmContact.ContactGender), nameof(ContactInfo.ContactGender) }, + // { nameof(ContactInfo.ContactStatusId), nameof(KXO.Models.OmContact.ContactStatusId) }, // No support 2022-07-07 but needs to be mapped because of constraint + { nameof(KX13M.OmContact.ContactNotes), nameof(ContactInfo.ContactNotes) }, + { nameof(KX13M.OmContact.ContactOwnerUserId), nameof(ContactInfo.ContactOwnerUserID) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactMonitored), nameof(KXO.Models.OmContact.ContactMonitored) }, + { nameof(KX13M.OmContact.ContactGuid), nameof(ContactInfo.ContactGUID) }, + { nameof(KX13M.OmContact.ContactLastModified), nameof(ContactInfo.ContactLastModified) }, + { nameof(KX13M.OmContact.ContactCreated), nameof(ContactInfo.ContactCreated) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactBounces), nameof(KXO.Models.OmContact.ContactBounces) }, + { nameof(KX13M.OmContact.ContactCampaign), nameof(ContactInfo.ContactCampaign) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadId), nameof(KXO.Models.OmContact.ContactSalesForceLeadId) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationDisabled), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDisabled) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationDateTime) }, + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationSuspensionDateTime), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationSuspensionDateTime) }, + { nameof(KX13M.OmContact.ContactCompanyName), nameof(ContactInfo.ContactCompanyName) } + // No support 2022-07-07 { nameof(ContactInfo.ContactSalesForceLeadReplicationRequired), nameof(KXO.Models.OmContact.ContactSalesForceLeadReplicationRequired) }, }; foreach (var cfi in kxpClassFacade.GetCustomizedFieldInfos(ContactInfo.TYPEINFO.ObjectClassName)) @@ -148,7 +141,7 @@ public Task Handle(MigrateContactManagementCommand request, Cance private ValueInterceptorResult ContactValueInterceptor(int ordinal, string columnName, object value, Dictionary currentRow) { - if (columnName.Equals(nameof(OmContact.ContactCompanyName), StringComparison.InvariantCultureIgnoreCase)) + if (columnName.Equals(nameof(ContactInfo.ContactCompanyName), StringComparison.InvariantCultureIgnoreCase)) { // autofix removed in favor of error report and data consistency // var truncatedValue = SqlDataTypeHelper.TruncateString(value, 100); @@ -170,7 +163,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(OmContact.ContactOwnerUserId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceUserId) + if (columnName.Equals(nameof(ContactInfo.ContactOwnerUserID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceUserId) { switch (primaryKeyMappingContext.MapSourceId(u => u.UserId, sourceUserId)) { @@ -179,18 +172,18 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum case { Success: false }: { // try search member - if (keyMappingContext.MapSourceKey( + if (keyMappingContext.MapSourceKey( s => s.UserId, s => s.UserGuid, sourceUserId, - t => t.MemberId, - t => t.MemberGuid + t => t.MemberID, + MemberInfo.Provider.Get ) is { Success: true, Mapped: { } memberId }) { return ValueInterceptorResult.ReplaceValue(memberId); } - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -200,7 +193,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(OmContact.ContactStateId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceStateId) + if (columnName.Equals(nameof(ContactInfo.ContactStateID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceStateId) { switch (primaryKeyMappingContext.MapSourceId(u => u.StateId, sourceStateId.NullIfZero())) { @@ -208,7 +201,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -218,7 +211,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum } } - if (columnName.Equals(nameof(OmContact.ContactCountryId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceCountryId) + if (columnName.Equals(nameof(ContactInfo.ContactCountryID), StringComparison.InvariantCultureIgnoreCase) && value is int sourceCountryId) { switch (primaryKeyMappingContext.MapSourceId(u => u.CountryId, sourceCountryId.NullIfZero())) { @@ -226,7 +219,7 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum return ValueInterceptorResult.ReplaceValue(id); case { Success: false }: { - protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) + protocol.Append(HandbookReferences.MissingRequiredDependency(columnName, value) .WithData(currentRow)); return ValueInterceptorResult.SkipRow; } @@ -248,25 +241,25 @@ private ValueInterceptorResult ContactValueInterceptor(int ordinal, string colum { var requiredColumnsForContactMigration = new Dictionary { - { nameof(KX13M.OmActivity.ActivityId), nameof(OmActivity.ActivityId) }, - { nameof(KX13M.OmActivity.ActivityContactId), nameof(OmActivity.ActivityContactId) }, - { nameof(KX13M.OmActivity.ActivityCreated), nameof(OmActivity.ActivityCreated) }, - { nameof(KX13M.OmActivity.ActivityType), nameof(OmActivity.ActivityType) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityItemId), nameof(KXO.Models.OmActivity.ActivityItemId) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityItemDetailId), nameof(KXO.Models.OmActivity.ActivityItemDetailId) }, - { nameof(KX13M.OmActivity.ActivityValue), nameof(OmActivity.ActivityValue) }, - { nameof(KX13M.OmActivity.ActivityUrl), nameof(OmActivity.ActivityUrl) }, - { nameof(KX13M.OmActivity.ActivityTitle), nameof(OmActivity.ActivityTitle) }, - { nameof(KX13M.OmActivity.ActivitySiteId), nameof(OmActivity.ActivityChannelId) }, - { nameof(KX13M.OmActivity.ActivityComment), nameof(OmActivity.ActivityComment) }, - // { nameof(OmActivity.ActivityCampaign), nameof(KXP.Models.OmActivity.ActivityCampaign) }, // deprecated without replacement in v27 - { nameof(KX13M.OmActivity.ActivityUrlreferrer), nameof(OmActivity.ActivityUrlreferrer) }, - { nameof(KX13M.OmActivity.ActivityCulture), nameof(OmActivity.ActivityLanguageId) }, - { nameof(KX13M.OmActivity.ActivityNodeId), nameof(OmActivity.ActivityWebPageItemGuid) }, - { nameof(KX13M.OmActivity.ActivityUtmsource), nameof(OmActivity.ActivityUtmsource) }, - // No support 2022-07-07 { nameof(OmActivity.ActivityAbvariantName), nameof(KXO.Models.OmActivity.ActivityAbvariantName) }, - // OBSOLETE 26.0.0: { nameof(OmActivity.ActivityUrlhash), nameof(KXP.Models.OmActivity.ActivityUrlhash) }, - { nameof(KX13M.OmActivity.ActivityUtmcontent), nameof(OmActivity.ActivityUtmcontent) } + { nameof(KX13M.OmActivity.ActivityId), nameof(ActivityInfo.ActivityID) }, + { nameof(KX13M.OmActivity.ActivityContactId), nameof(ActivityInfo.ActivityContactID) }, + { nameof(KX13M.OmActivity.ActivityCreated), nameof(ActivityInfo.ActivityCreated) }, + { nameof(KX13M.OmActivity.ActivityType), nameof(ActivityInfo.ActivityType) }, + // No support 2022-07-07 { nameof(ActivityInfo.ActivityItemId), nameof(KXO.Models.OmActivity.ActivityItemId) }, + // No support 2022-07-07 { nameof(ActivityInfo.ActivityItemDetailId), nameof(KXO.Models.OmActivity.ActivityItemDetailId) }, + { nameof(KX13M.OmActivity.ActivityValue), nameof(ActivityInfo.ActivityValue) }, + { nameof(KX13M.OmActivity.ActivityUrl), nameof(ActivityInfo.ActivityURL) }, + { nameof(KX13M.OmActivity.ActivityTitle), nameof(ActivityInfo.ActivityTitle) }, + { nameof(KX13M.OmActivity.ActivitySiteId), nameof(ActivityInfo.ActivityChannelID) }, + { nameof(KX13M.OmActivity.ActivityComment), nameof(ActivityInfo.ActivityComment) }, + // { nameof(ActivityInfo.ActivityCampaign), nameof(KXP.Models.OmActivity.ActivityCampaign) }, // deprecated without replacement in v27 + { nameof(KX13M.OmActivity.ActivityUrlreferrer), nameof(ActivityInfo.ActivityURLReferrer) }, + { nameof(KX13M.OmActivity.ActivityCulture), nameof(ActivityInfo.ActivityLanguageID) }, + { nameof(KX13M.OmActivity.ActivityNodeId), nameof(ActivityInfo.ActivityWebPageItemGUID) }, + { nameof(KX13M.OmActivity.ActivityUtmsource), nameof(ActivityInfo.ActivityUTMSource) }, + // No support 2022-07-07 { nameof(ActivityInfo.ActivityAbvariantName), nameof(KXO.Models.OmActivity.ActivityAbvariantName) }, + // OBSOLETE 26.0.0: { nameof(ActivityInfo.ActivityUrlhash), nameof(KXP.Models.OmActivity.ActivityUrlhash) }, + { nameof(KX13M.OmActivity.ActivityUtmcontent), nameof(ActivityInfo.ActivityUTMContent) } }; foreach (var cfi in kxpClassFacade.GetCustomizedFieldInfos(ActivityInfo.TYPEINFO.ObjectClassName)) @@ -311,12 +304,12 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin if (columnName.Equals(nameof(KX13M.OmActivity.ActivitySiteId), StringComparison.InvariantCultureIgnoreCase) && value is int sourceActivitySiteId) { - var result = keyMappingContext.MapSourceKey( + var result = keyMappingContext.MapSourceKey( s => s.SiteId, s => s.SiteGuid, sourceActivitySiteId.NullIfZero(), - t => t.ChannelId, - t => t.ChannelGuid + t => t.ChannelID, + guid => ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), guid).SingleOrDefault() ); switch (result) { @@ -335,7 +328,7 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) + .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; @@ -368,7 +361,7 @@ private ValueInterceptorResult ActivityValueInterceptor(int columnOrdinal, strin case AutofixEnum.Error: default: //error protocol.Append(HandbookReferences - .MissingRequiredDependency(columnName, value) + .MissingRequiredDependency(columnName, value) .WithData(currentRow) ); return ValueInterceptorResult.SkipRow; diff --git a/Migration.Tool.Core.KX13/Handlers/MigrateDataProtectionCommandHandler.cs b/Migration.Tool.Core.KX13/Handlers/MigrateDataProtectionCommandHandler.cs index 605d6a62..57966226 100644 --- a/Migration.Tool.Core.KX13/Handlers/MigrateDataProtectionCommandHandler.cs +++ b/Migration.Tool.Core.KX13/Handlers/MigrateDataProtectionCommandHandler.cs @@ -1,8 +1,7 @@ +using CMS.DataEngine; using CMS.DataProtection; using MediatR; - -using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -11,49 +10,39 @@ using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX13.Contexts; using Migration.Tool.KX13.Context; -using Migration.Tool.KXP.Context; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Handlers; -public class MigrateDataProtectionCommandHandler : IRequestHandler, IDisposable +public class MigrateDataProtectionCommandHandler : IRequestHandler { private static readonly int batchSize = 1000; - private readonly IEntityMapper consentAgreementMapper; - private readonly IEntityMapper consentArchiveMapper; - private readonly IEntityMapper consentMapper; + private readonly IEntityMapper consentAgreementMapper; + private readonly IEntityMapper consentArchiveMapper; + private readonly IEntityMapper consentMapper; private readonly IDbContextFactory kx13ContextFactory; - private readonly IDbContextFactory kxpContextFactory; private readonly ILogger logger; private readonly PrimaryKeyMappingContext primaryKeyMappingContext; private readonly IProtocol protocol; - private KxpContext kxpContext; - public MigrateDataProtectionCommandHandler( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory kx13ContextFactory, - IEntityMapper consentMapper, - IEntityMapper consentArchiveMapper, - IEntityMapper consentAgreementMapper, + IEntityMapper consentMapper, + IEntityMapper consentArchiveMapper, + IEntityMapper consentAgreementMapper, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol ) { this.logger = logger; - this.kxpContextFactory = kxpContextFactory; this.kx13ContextFactory = kx13ContextFactory; this.consentMapper = consentMapper; this.consentArchiveMapper = consentArchiveMapper; this.consentAgreementMapper = consentAgreementMapper; this.primaryKeyMappingContext = primaryKeyMappingContext; this.protocol = protocol; - kxpContext = this.kxpContextFactory.CreateDbContext(); } - public void Dispose() => kxpContext.Dispose(); - public async Task Handle(MigrateDataProtectionCommand request, CancellationToken cancellationToken) { await MigrateConsent(cancellationToken); @@ -72,7 +61,7 @@ private async Task MigrateConsent(CancellationToken cancellationT protocol.FetchedSource(kx13Consent); logger.LogTrace("Migrating consent {ConsentName} with ConsentGuid {ConsentGuid}", kx13Consent.ConsentName, kx13Consent.ConsentGuid); - var kxoConsent = await kxpContext.CmsConsents.FirstOrDefaultAsync(consent => consent.ConsentGuid == kx13Consent.ConsentGuid, cancellationToken); + var kxoConsent = ConsentInfo.Provider.Get().WhereEquals(nameof(ConsentInfo.ConsentGuid), kx13Consent.ConsentGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsent); var mapped = consentMapper.Map(kx13Consent, kxoConsent); @@ -80,37 +69,35 @@ private async Task MigrateConsent(CancellationToken cancellationT if (mapped is { Success: true } result) { - (var cmsConsent, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsent, nameof(cmsConsent)); - - if (newInstance) - { - kxpContext.CmsConsents.Add(cmsConsent); - } - else - { - kxpContext.CmsConsents.Update(cmsConsent); - } + (var consentInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(consentInfo, nameof(consentInfo)); try { - await kxpContext.SaveChangesAsync(cancellationToken); + using (var conn = ConnectionHelper.GetConnection()) + { + using var scope = new CMSTransactionScope(conn); + string originalHash = consentInfo.ConsentHash; + + ConsentInfo.Provider.Set(consentInfo); + + // Provider regenerates the hash. Manually revert to the original one + conn.DataConnection.ExecuteNonQuery("UPDATE [CMS_Consent] SET ConsentHash=@originalHash", new QueryDataParameters() { { "originalHash", originalHash } }, QueryTypeEnum.SQLQuery, true); + scope.Commit(); + } - protocol.Success(kx13Consent, cmsConsent, mapped); - logger.LogEntitySetAction(newInstance, cmsConsent); - primaryKeyMappingContext.SetMapping(r => r.ConsentId, kx13Consent.ConsentId, cmsConsent.ConsentId); + protocol.Success(kx13Consent, consentInfo, mapped); + logger.LogEntitySetAction(newInstance, consentInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentId, kx13Consent.ConsentId, consentInfo.ConsentID); } - /*Violation in unique index or Violation in unique constraint */ - catch (DbUpdateException dbUpdateException) when (dbUpdateException.InnerException is SqlException { Number: 2601 or 2627 } sqlException) + catch (Exception ex) { - logger.LogEntitySetError(sqlException, newInstance, kx13Consent); + logger.LogEntitySetError(ex, newInstance, consentInfo); protocol.Append(HandbookReferences - .DbConstraintBroken(sqlException, kx13Consent) - .WithMessage("Failed to migrate consent, target database constraint broken.") + .ErrorCreatingTargetInstance(ex) + .NeedsManualAction() + .WithIdentityPrint(consentInfo) ); - - await kxpContext.DisposeAsync(); - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); } } } @@ -127,7 +114,7 @@ private async Task MigrateConsentArchive(CancellationToken cancel protocol.FetchedSource(kx13ArchiveConsent); logger.LogTrace("Migrating consent archive with ConsentArchiveGuid {ConsentGuid}", kx13ArchiveConsent.ConsentArchiveGuid); - var kxoConsentArchive = await kxpContext.CmsConsentArchives.FirstOrDefaultAsync(consentArchive => consentArchive.ConsentArchiveGuid == kx13ArchiveConsent.ConsentArchiveGuid, cancellationToken); + var kxoConsentArchive = ConsentArchiveInfo.Provider.Get().WhereEquals(nameof(ConsentArchiveInfo.ConsentArchiveGuid), kx13ArchiveConsent.ConsentArchiveGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsentArchive); var mapped = consentArchiveMapper.Map(kx13ArchiveConsent, kxoConsentArchive); @@ -135,39 +122,14 @@ private async Task MigrateConsentArchive(CancellationToken cancel if (mapped is { Success: true } result) { - (var cmsConsentArchive, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsentArchive, nameof(cmsConsentArchive)); - - if (newInstance) - { - kxpContext.CmsConsentArchives.Add(cmsConsentArchive); - } - else - { - kxpContext.CmsConsentArchives.Update(cmsConsentArchive); - } - - try - { - await kxpContext.SaveChangesAsync(cancellationToken); - - protocol.Success(kx13ArchiveConsent, cmsConsentArchive, mapped); - logger.LogEntitySetAction(newInstance, cmsConsentArchive); - primaryKeyMappingContext.SetMapping(r => r.ConsentArchiveGuid, - kx13ArchiveConsent.ConsentArchiveId, cmsConsentArchive.ConsentArchiveId); - } - /*Violation in unique index or Violation in unique constraint */ - catch (DbUpdateException dbUpdateException) when (dbUpdateException.InnerException is SqlException { Number: 2601 or 2627 } sqlException) - { - logger.LogEntitySetError(sqlException, newInstance, kx13ArchiveConsent); - protocol.Append(HandbookReferences - .DbConstraintBroken(sqlException, kx13ArchiveConsent) - .WithMessage("Failed to migrate consent archive, target database constraint broken.") - ); - - await kxpContext.DisposeAsync(); - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); - } + (var consentArchiveInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(consentArchiveInfo, nameof(consentArchiveInfo)); + + ConsentArchiveInfo.Provider.Set(consentArchiveInfo); + protocol.Success(kx13ArchiveConsent, consentArchiveInfo, mapped); + logger.LogEntitySetAction(newInstance, consentArchiveInfo); + primaryKeyMappingContext.SetMapping(r => r.ConsentArchiveGuid, + kx13ArchiveConsent.ConsentArchiveId, consentArchiveInfo.ConsentArchiveID); } } @@ -179,8 +141,8 @@ private async Task MigrateConsentAgreement(CancellationToken canc await using var kx13Context = await kx13ContextFactory.CreateDbContextAsync(cancellationToken); int index = 0; int indexFull = 0; - var consentAgreementUpdates = new List(); - var consentAgreementNews = new List(); + var consentAgreementUpdates = new List(); + var consentAgreementNews = new List(); int itemsCount = kx13Context.CmsConsentAgreements.Count(); foreach (var kx13ConsentAgreement in kx13Context.CmsConsentAgreements) @@ -188,7 +150,7 @@ private async Task MigrateConsentAgreement(CancellationToken canc protocol.FetchedSource(kx13ConsentAgreement); logger.LogTrace("Migrating consent agreement with ConsentAgreementGuid {ConsentAgreementGuid}", kx13ConsentAgreement.ConsentAgreementGuid); - var kxoConsentAgreement = await kxpContext.CmsConsentAgreements.FirstOrDefaultAsync(consentAgreement => consentAgreement.ConsentAgreementGuid == kx13ConsentAgreement.ConsentAgreementGuid, cancellationToken); + var kxoConsentAgreement = ConsentAgreementInfo.Provider.Get().WhereEquals(nameof(ConsentAgreementInfo.ConsentAgreementGuid), kx13ConsentAgreement.ConsentAgreementGuid).FirstOrDefault(); protocol.FetchedTarget(kxoConsentAgreement); var mapped = consentAgreementMapper.Map(kx13ConsentAgreement, kxoConsentAgreement); @@ -196,16 +158,16 @@ private async Task MigrateConsentAgreement(CancellationToken canc if (mapped is { Success: true } result) { - (var cmsConsentAgreement, bool newInstance) = result; - ArgumentNullException.ThrowIfNull(cmsConsentAgreement, nameof(cmsConsentAgreement)); + (var agreementInfo, bool newInstance) = result; + ArgumentNullException.ThrowIfNull(agreementInfo, nameof(agreementInfo)); if (newInstance) { - consentAgreementNews.Add(cmsConsentAgreement); + consentAgreementNews.Add(agreementInfo); } else { - consentAgreementUpdates.Add(cmsConsentAgreement); + ConsentAgreementInfo.Provider.Set(agreementInfo); } } @@ -214,58 +176,15 @@ private async Task MigrateConsentAgreement(CancellationToken canc if (index == batchSize || indexFull == itemsCount) { - kxpContext.CmsConsentAgreements.AddRange(consentAgreementNews); - kxpContext.CmsConsentAgreements.UpdateRange(consentAgreementUpdates); - try { - await kxpContext.SaveChangesAsync(cancellationToken); - + ConsentAgreementInfo.Provider.BulkInsert(consentAgreementNews); foreach (var newKx13ConsentAgreement in consentAgreementNews) { protocol.Success(kx13ConsentAgreement, newKx13ConsentAgreement, mapped); logger.LogDebug("CmsConsentAgreement: with ConsentAgreementGuid \'{ConsentAgreementGuid}\' was inserted", newKx13ConsentAgreement.ConsentAgreementGuid); } - - foreach (var updateKx13ConsentAgreement in consentAgreementUpdates) - { - protocol.Success(kx13ConsentAgreement, updateKx13ConsentAgreement, mapped); - logger.LogDebug("CmsConsentAgreement: with ConsentAgreementGuid \'{ConsentAgreementGuid}\' was updated", - updateKx13ConsentAgreement.ConsentAgreementGuid); - } - } - catch (DbUpdateException dbUpdateException) when ( - dbUpdateException.InnerException is SqlException sqlException && - sqlException.Message.Contains("Cannot insert duplicate key row in object") - ) - { - await kxpContext.DisposeAsync(); - - protocol.Append(HandbookReferences - .ErrorCreatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrints(consentAgreementNews) - ); - logger.LogEntitiesSetError(dbUpdateException, true, consentAgreementNews); - - - protocol.Append(HandbookReferences - .ErrorUpdatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrints(consentAgreementUpdates) - ); - - var cai = ConsentAgreementInfo.New(); - protocol.Append(HandbookReferences - .ErrorUpdatingTargetInstance(dbUpdateException) - .NeedsManualAction() - .WithIdentityPrint(cai) - ); - - logger.LogEntitiesSetError(dbUpdateException, false, consentAgreementUpdates); - - kxpContext = await kxpContextFactory.CreateDbContextAsync(cancellationToken); } finally { diff --git a/Migration.Tool.Core.KX13/Handlers/MigrateUsersCommandHandler.cs b/Migration.Tool.Core.KX13/Handlers/MigrateUsersCommandHandler.cs index 0c90eae6..c0e9c136 100644 --- a/Migration.Tool.Core.KX13/Handlers/MigrateUsersCommandHandler.cs +++ b/Migration.Tool.Core.KX13/Handlers/MigrateUsersCommandHandler.cs @@ -12,7 +12,6 @@ using Migration.Tool.Core.KX13.Contexts; using Migration.Tool.KX13.Context; using Migration.Tool.KXP.Api.Enums; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Handlers; @@ -195,7 +194,7 @@ private async Task MigrateUserRole(int kx13RoleId) if (!primaryKeyMappingContext.TryRequireMapFromSource(u => u.RoleId, kx13RoleId, out int xbkRoleId)) { var handbookRef = HandbookReferences - .MissingRequiredDependency(nameof(UserRoleInfo.RoleID), kx13UserRole.RoleId) + .MissingRequiredDependency(nameof(UserRoleInfo.RoleID), kx13UserRole.RoleId) .NeedsManualAction(); protocol.Append(handbookRef); diff --git a/Migration.Tool.Core.KX13/Helpers/Printer.cs b/Migration.Tool.Core.KX13/Helpers/Printer.cs index 97b0e4d3..9f3837ac 100644 --- a/Migration.Tool.Core.KX13/Helpers/Printer.cs +++ b/Migration.Tool.Core.KX13/Helpers/Printer.cs @@ -1,13 +1,14 @@ +using CMS.ContactManagement; using CMS.DataEngine; +using CMS.DataProtection; using CMS.FormEngine; using CMS.Globalization; using CMS.MediaLibrary; using CMS.Membership; using CMS.Modules; - +using CMS.OnlineForms; using Migration.Tool.Common.Helpers; using Migration.Tool.Common.Services; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Helpers; @@ -19,15 +20,15 @@ public static string PrintKxpModelInfo(T model) return model switch { - MediaLibrary mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGuid)}={mediaLibrary.LibraryGuid}", - MediaFile mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGuid)}={mediaFile.FileGuid}", - CmsRole role => $"{currentTypeName}: {nameof(role.RoleGuid)}={role.RoleGuid}, {nameof(role.RoleName)}={role.RoleName}", - CmsUser user => $"{currentTypeName}: {nameof(user.UserGuid)}={user.UserGuid}, {nameof(user.UserName)}={user.UserName}", - CmsResource resource => $"{currentTypeName}: {nameof(resource.ResourceGuid)}={resource.ResourceGuid}, {nameof(resource.ResourceName)}={resource.ResourceName}", - CmsSettingsCategory settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", - CmsSettingsKey settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGuid)}={settingsKey.KeyGuid}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", - CmsForm form => $"{currentTypeName}: {nameof(form.FormGuid)}={form.FormGuid}, {nameof(form.FormName)}={form.FormName}", - OmContactGroup omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGuid)}={omContactGroup.ContactGroupGuid}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", + MediaLibraryInfo mediaLibrary => $"{currentTypeName}: {nameof(mediaLibrary.LibraryGUID)}={mediaLibrary.LibraryGUID}", + MediaFileInfo mediaFile => $"{currentTypeName}: {nameof(mediaFile.FileGUID)}={mediaFile.FileGUID}", + RoleInfo role => $"{currentTypeName}: {nameof(role.RoleGUID)}={role.RoleGUID}, {nameof(role.RoleName)}={role.RoleName}", + UserInfo user => $"{currentTypeName}: {nameof(user.UserGUID)}={user.UserGUID}, {nameof(user.UserName)}={user.UserName}", + ResourceInfo resource => $"{currentTypeName}: {nameof(resource.ResourceGUID)}={resource.ResourceGUID}, {nameof(resource.ResourceName)}={resource.ResourceName}", + SettingsCategoryInfo settingsCategory => $"{currentTypeName}: {nameof(settingsCategory.CategoryName)}={settingsCategory.CategoryName}", + SettingsKeyInfo settingsKey => $"{currentTypeName}: {nameof(settingsKey.KeyGUID)}={settingsKey.KeyGUID}, {nameof(settingsKey.KeyName)}={settingsKey.KeyName}", + BizFormInfo form => $"{currentTypeName}: {nameof(form.FormGUID)}={form.FormGUID}, {nameof(form.FormName)}={form.FormName}", + ContactGroupInfo omContactGroup => $"{currentTypeName}: {nameof(omContactGroup.ContactGroupGUID)}={omContactGroup.ContactGroupGUID}, {nameof(omContactGroup.ContactGroupName)}={omContactGroup.ContactGroupName}", null => $"{currentTypeName}: ", _ => $"TODO: {typeof(T).FullName}" @@ -61,12 +62,11 @@ string FormatModel(string inner) => printType RoleInfo item => FormatModel($"ID={item.RoleID}, Guid={item.RoleGUID} Name={item.RoleName}"), MemberInfo item => FormatModel($"ID={item.MemberID}, Guid={item.MemberGuid} Name={item.MemberName}"), - CmsForm item => FormatModel($"ID={item.FormId}, GUID={item.FormGuid}, Name={item.FormName}"), - CmsUser item => FormatModel($"ID={item.UserId}, GUID={item.UserGuid}, Name={item.UserName}"), - CmsConsent item => FormatModel($"ID={item.ConsentId}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), - CmsConsentArchive item => FormatModel($"ID={item.ConsentArchiveId}, GUID={item.ConsentArchiveGuid}"), - CmsConsentAgreement item => FormatModel($"ID={item.ConsentAgreementId}, GUID={item.ConsentAgreementGuid}"), - CmsSettingsKey item => FormatModel($"ID={item.KeyId}, GUID={item.KeyGuid}, Name={item.KeyName}"), + BizFormInfo item => FormatModel($"ID={item.FormID}, GUID={item.FormGUID}, Name={item.FormName}"), + ConsentInfo item => FormatModel($"ID={item.ConsentID}, GUID={item.ConsentGuid}, Name={item.ConsentName}"), + ConsentArchiveInfo item => FormatModel($"ID={item.ConsentArchiveID}, GUID={item.ConsentArchiveGuid}"), + ConsentAgreementInfo item => FormatModel($"ID={item.ConsentAgreementID}, GUID={item.ConsentAgreementGuid}"), + SettingsKeyInfo item => FormatModel($"ID={item.KeyID}, GUID={item.KeyGUID}, Name={item.KeyName}"), KX13M.CmsPageTemplateConfiguration item => FormatModel($"ID={item.PageTemplateConfigurationId}, GUID={item.PageTemplateConfigurationGuid}, Name={item.PageTemplateConfigurationName}, SiteId={item.PageTemplateConfigurationSiteId}"), KX13M.CmsRole item => FormatModel($"ID={item.RoleId}, GUID={item.RoleGuid}, Name={item.RoleName}, SiteId={item.SiteId}"), diff --git a/Migration.Tool.Core.KX13/Mappers/CmsConsentAgreementMapper.cs b/Migration.Tool.Core.KX13/Mappers/CmsConsentAgreementMapper.cs index 96f879c2..5d494245 100644 --- a/Migration.Tool.Core.KX13/Mappers/CmsConsentAgreementMapper.cs +++ b/Migration.Tool.Core.KX13/Mappers/CmsConsentAgreementMapper.cs @@ -1,21 +1,21 @@ +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Mappers; -public class CmsConsentAgreementMapper : EntityMapperBase +public class CmsConsentAgreementMapper : EntityMapperBase { public CmsConsentAgreementMapper(ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) : base(logger, primaryKeyMappingContext, protocol) { } - protected override CmsConsentAgreement? CreateNewInstance(KX13M.CmsConsentAgreement source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentAgreementInfo? CreateNewInstance(KX13M.CmsConsentAgreement source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override CmsConsentAgreement MapInternal(KX13M.CmsConsentAgreement source, CmsConsentAgreement target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + protected override ConsentAgreementInfo MapInternal(KX13M.CmsConsentAgreement source, ConsentAgreementInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentAgreementGuid = source.ConsentAgreementGuid; target.ConsentAgreementRevoked = source.ConsentAgreementRevoked; @@ -24,12 +24,12 @@ protected override CmsConsentAgreement MapInternal(KX13M.CmsConsentAgreement sou if (mappingHelper.TranslateRequiredId(c => c.ContactId, source.ConsentAgreementContactId, out int contactId)) { - target.ConsentAgreementContactId = contactId; + target.ConsentAgreementContactID = contactId; } if (mappingHelper.TranslateRequiredId(r => r.ConsentId, source.ConsentAgreementConsentId, out int consentId)) { - target.ConsentAgreementConsentId = consentId; + target.ConsentAgreementConsentID = consentId; } return target; diff --git a/Migration.Tool.Core.KX13/Mappers/CmsConsentArchiveMapper.cs b/Migration.Tool.Core.KX13/Mappers/CmsConsentArchiveMapper.cs index a70cf168..f7622c92 100644 --- a/Migration.Tool.Core.KX13/Mappers/CmsConsentArchiveMapper.cs +++ b/Migration.Tool.Core.KX13/Mappers/CmsConsentArchiveMapper.cs @@ -1,22 +1,22 @@ +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Mappers; -public class CmsConsentArchiveMapper : EntityMapperBase +public class CmsConsentArchiveMapper : EntityMapperBase { public CmsConsentArchiveMapper(ILogger logger, PrimaryKeyMappingContext primaryKeyMappingContext, IProtocol protocol) : base(logger, primaryKeyMappingContext, protocol) { } - protected override CmsConsentArchive? CreateNewInstance(KX13M.CmsConsentArchive source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentArchiveInfo? CreateNewInstance(KX13M.CmsConsentArchive source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override CmsConsentArchive MapInternal(KX13M.CmsConsentArchive source, CmsConsentArchive target, bool newInstance, + protected override ConsentArchiveInfo MapInternal(KX13M.CmsConsentArchive source, ConsentArchiveInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentArchiveContent = source.ConsentArchiveContent; @@ -26,7 +26,7 @@ protected override CmsConsentArchive MapInternal(KX13M.CmsConsentArchive source, if (mappingHelper.TranslateRequiredId(r => r.ConsentId, source.ConsentArchiveConsentId, out int consentId)) { - target.ConsentArchiveConsentId = consentId; + target.ConsentArchiveConsentID = consentId; } return target; diff --git a/Migration.Tool.Core.KX13/Mappers/CmsConsentMapper.cs b/Migration.Tool.Core.KX13/Mappers/CmsConsentMapper.cs index cf348d3f..af1d0544 100644 --- a/Migration.Tool.Core.KX13/Mappers/CmsConsentMapper.cs +++ b/Migration.Tool.Core.KX13/Mappers/CmsConsentMapper.cs @@ -3,25 +3,24 @@ using System.Xml.XPath; using CMS.ContentEngine; - +using CMS.DataProtection; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Mappers; -public class CmsConsentMapper : EntityMapperBase +public class CmsConsentMapper : EntityMapperBase { public CmsConsentMapper(ILogger logger, PrimaryKeyMappingContext pkContext, IProtocol protocol) : base(logger, pkContext, protocol) { } - protected override CmsConsent? CreateNewInstance(KX13M.CmsConsent source, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ConsentInfo? CreateNewInstance(KX13M.CmsConsent source, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override CmsConsent MapInternal(KX13M.CmsConsent source, CmsConsent target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) + protected override ConsentInfo MapInternal(KX13M.CmsConsent source, ConsentInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ConsentDisplayName = source.ConsentDisplayName; var defaultContentLanguageInfo = ContentLanguageInfo.Provider.Get().WhereEquals(nameof(ContentLanguageInfo.ContentLanguageIsDefault), true).FirstOrDefault() ?? throw new InvalidCastException("Missing default content language"); @@ -29,7 +28,7 @@ protected override CmsConsent MapInternal(KX13M.CmsConsent source, CmsConsent ta target.ConsentContent = ConsentContentPatcher.PatchConsentContent(source.ConsentContent, defaultContentLanguageInfo); target.ConsentGuid = source.ConsentGuid; target.ConsentLastModified = source.ConsentLastModified; - target.ConsentHash = source.ConsentHash; + target.SetValue(nameof(target.ConsentHash), source.ConsentHash); return target; } diff --git a/Migration.Tool.Core.KX13/Mappers/CmsSettingsCategoryMapper.cs b/Migration.Tool.Core.KX13/Mappers/CmsSettingsCategoryMapper.cs deleted file mode 100644 index fdd8e826..00000000 --- a/Migration.Tool.Core.KX13/Mappers/CmsSettingsCategoryMapper.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; - -namespace Migration.Tool.Core.KX13.Mappers; - -public class CmsSettingsCategoryMapper( - ILogger logger, - PrimaryKeyMappingContext pkContext, - IProtocol protocol, - IEntityMapper cmsResourceMapper) - : EntityMapperBase(logger, pkContext, protocol) -{ - protected override CmsSettingsCategory? CreateNewInstance(KX13M.CmsSettingsCategory source, MappingHelper mappingHelper, - AddFailure addFailure) => new(); - - - protected override CmsSettingsCategory MapInternal(KX13M.CmsSettingsCategory source, CmsSettingsCategory target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - // no category guid to match on... - if (newInstance) - { - target.CategoryOrder = source.CategoryOrder; - target.CategoryName = source.CategoryName; - target.CategoryDisplayName = source.CategoryDisplayName; - target.CategoryIdpath = source.CategoryIdpath; - target.CategoryLevel = source.CategoryLevel; - target.CategoryChildCount = source.CategoryChildCount; - target.CategoryIconPath = source.CategoryIconPath; - target.CategoryIsGroup = source.CategoryIsGroup; - target.CategoryIsCustom = source.CategoryIsCustom; - } - - if (source.CategoryResource != null) - { - if (target.CategoryResource != null && source.CategoryResourceId != null && target.CategoryResourceId != null) - { - // skip if target is present - logger.LogTrace("Skipping category resource '{ResourceGuid}', already present in target instance", target.CategoryResource.ResourceGuid); - pkContext.SetMapping(r => r.ResourceId, source.CategoryResourceId.Value, target.CategoryResourceId.Value); - } - else - { - switch (cmsResourceMapper.Map(source.CategoryResource, target.CategoryResource)) - { - case { Success: true } result: - { - target.CategoryResource = result.Item; - break; - } - case { Success: false } result: - { - addFailure(new MapperResultFailure(result.HandbookReference)); - break; - } - - default: - break; - } - } - } - else if (mappingHelper.TranslateIdAllowNulls(r => r.ResourceId, source.CategoryResourceId, out int? categoryResourceId)) - { - target.CategoryResourceId = categoryResourceId; - } - - if (source.CategoryParent != null) - { - switch (Map(source.CategoryParent, target.CategoryParent)) - { - case { Success: true } result: - { - target.CategoryParent = result.Item; - break; - } - case { Success: false } result: - { - addFailure(new MapperResultFailure(result.HandbookReference)); - break; - } - - default: - break; - } - } - else if (mappingHelper.TranslateIdAllowNulls(c => c.CategoryId, source.CategoryParentId, out int? categoryParentId)) - { - target.CategoryParentId = categoryParentId; - } - - return target; - } -} diff --git a/Migration.Tool.Core.KX13/Mappers/CmsUserMapper.cs b/Migration.Tool.Core.KX13/Mappers/CmsUserMapper.cs deleted file mode 100644 index af795534..00000000 --- a/Migration.Tool.Core.KX13/Mappers/CmsUserMapper.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.Extensions.Logging; - -using Migration.Tool.Common.Abstractions; -using Migration.Tool.Common.MigrationProtocol; -using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; - -namespace Migration.Tool.Core.KX13.Mappers; - -public class CmsUserMapper( - ILogger logger, - PrimaryKeyMappingContext primaryKeyMappingContext, - IProtocol protocol) : EntityMapperBase(logger, primaryKeyMappingContext, protocol) -{ - protected override CmsUser CreateNewInstance(KX13M.CmsUser tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - - protected override CmsUser MapInternal(KX13M.CmsUser source, CmsUser target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) - { - if (!newInstance && source.UserGuid != target.UserGuid) - { - // assertion failed - logger.LogTrace("Assertion failed, entity key mismatch"); - throw new InvalidOperationException("Assertion failed, entity key mismatch."); - } - - target.UserName = source.UserName; - target.FirstName = source.FirstName; - target.LastName = source.LastName; - target.Email = source.Email; - target.UserPassword = source.UserPassword; - target.UserEnabled = source.UserEnabled; - target.UserCreated = source.UserCreated; - target.LastLogon = source.LastLogon; - target.UserGuid = source.UserGuid; - target.UserLastModified = source.UserLastModified; - target.UserSecurityStamp = source.UserSecurityStamp; - target.UserAdministrationAccess = source.UserPrivilegeLevel == 3; - target.UserIsPendingRegistration = false; - target.UserPasswordLastChanged = null; - target.UserRegistrationLinkExpiration = DateTime.Now.AddDays(365); - - foreach (var sourceCmsUserRole in source.CmsUserRoles) - { - if (mappingHelper.TranslateRequiredId(r => r.RoleId, sourceCmsUserRole.RoleId, out int targetRoleId)) - { - if (target.CmsUserRoles.All(x => x.RoleId != targetRoleId)) - { - target.CmsUserRoles.Add(new CmsUserRole { RoleId = targetRoleId, User = target }); - } - } - } - - return target; - } -} diff --git a/Migration.Tool.Core.KX13/Mappers/OmContactGroupMapper.cs b/Migration.Tool.Core.KX13/Mappers/OmContactGroupMapper.cs index 8c96596a..5758dd68 100644 --- a/Migration.Tool.Core.KX13/Mappers/OmContactGroupMapper.cs +++ b/Migration.Tool.Core.KX13/Mappers/OmContactGroupMapper.cs @@ -1,13 +1,13 @@ +using CMS.ContactManagement; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Mappers; -public class OmContactGroupMapper : EntityMapperBase +public class OmContactGroupMapper : EntityMapperBase { public OmContactGroupMapper( ILogger logger, @@ -17,19 +17,36 @@ IProtocol protocol { } - protected override OmContactGroup? CreateNewInstance(KX13M.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); + protected override ContactGroupInfo? CreateNewInstance(KX13M.OmContactGroup tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override OmContactGroup MapInternal(KX13M.OmContactGroup source, OmContactGroup target, bool newInstance, + protected override ContactGroupInfo MapInternal(KX13M.OmContactGroup source, ContactGroupInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { + T RequireValue(string propertyName, T? value, T defaultValue) where T : struct + { + if (value.HasValue) + { + return value.Value; + } + else + { + addFailure(new MapperResultFailure( + HandbookReferences.InvalidSourceData() + .WithMessage("Required property value is null") + .WithId(nameof(source.ContactGroupId), source.ContactGroupId) + .WithData(new { MissingProperty = propertyName }))); + return defaultValue; + } + } + target.ContactGroupName = source.ContactGroupName; target.ContactGroupDisplayName = source.ContactGroupDisplayName; target.ContactGroupDescription = source.ContactGroupDescription; target.ContactGroupDynamicCondition = source.ContactGroupDynamicCondition; - target.ContactGroupEnabled = source.ContactGroupEnabled; - target.ContactGroupLastModified = source.ContactGroupLastModified; - target.ContactGroupGuid = source.ContactGroupGuid; - target.ContactGroupStatus = source.ContactGroupStatus; + target.ContactGroupEnabled = RequireValue(nameof(source.ContactGroupEnabled), source.ContactGroupEnabled, false); + target.ContactGroupLastModified = RequireValue(nameof(source.ContactGroupLastModified), source.ContactGroupLastModified, DateTime.MinValue); + target.ContactGroupGUID = RequireValue(nameof(source.ContactGroupGuid), source.ContactGroupGuid, Guid.Empty); + target.ContactGroupStatus = (ContactGroupStatusEnum)RequireValue(nameof(source.ContactGroupStatus), source.ContactGroupStatus, 0); return target; } diff --git a/Migration.Tool.Core.KX13/Mappers/OmContactStatusMapper.cs b/Migration.Tool.Core.KX13/Mappers/OmContactStatusMapper.cs index 622c1166..b3249ba7 100644 --- a/Migration.Tool.Core.KX13/Mappers/OmContactStatusMapper.cs +++ b/Migration.Tool.Core.KX13/Mappers/OmContactStatusMapper.cs @@ -1,13 +1,13 @@ +using CMS.ContactManagement; using Microsoft.Extensions.Logging; using Migration.Tool.Common.Abstractions; using Migration.Tool.Common.MigrationProtocol; using Migration.Tool.Core.KX13.Contexts; -using Migration.Tool.KXP.Models; namespace Migration.Tool.Core.KX13.Mappers; -public class OmContactStatusMapper : EntityMapperBase +public class OmContactStatusMapper : EntityMapperBase { public OmContactStatusMapper( ILogger logger, @@ -17,10 +17,10 @@ IProtocol protocol { } - protected override OmContactStatus? CreateNewInstance(KX13M.OmContactStatus tSourceEntity, MappingHelper mappingHelper, + protected override ContactStatusInfo? CreateNewInstance(KX13M.OmContactStatus tSourceEntity, MappingHelper mappingHelper, AddFailure addFailure) => new(); - protected override OmContactStatus MapInternal(KX13M.OmContactStatus source, OmContactStatus target, bool newInstance, + protected override ContactStatusInfo MapInternal(KX13M.OmContactStatus source, ContactStatusInfo target, bool newInstance, MappingHelper mappingHelper, AddFailure addFailure) { target.ContactStatusName = source.ContactStatusName; diff --git a/Migration.Tool.Core.KX13/Migration.Tool.Core.KX13.csproj b/Migration.Tool.Core.KX13/Migration.Tool.Core.KX13.csproj index b9e0581f..704f8c5a 100644 --- a/Migration.Tool.Core.KX13/Migration.Tool.Core.KX13.csproj +++ b/Migration.Tool.Core.KX13/Migration.Tool.Core.KX13.csproj @@ -8,7 +8,6 @@ - diff --git a/Migration.Tool.Core.KX13/Services/KeyLocatorService.cs b/Migration.Tool.Core.KX13/Services/KeyLocatorService.cs index 8663ea3a..2f56629a 100644 --- a/Migration.Tool.Core.KX13/Services/KeyLocatorService.cs +++ b/Migration.Tool.Core.KX13/Services/KeyLocatorService.cs @@ -5,24 +5,21 @@ using Microsoft.Extensions.Logging; using Migration.Tool.KX13.Context; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.KX13.Services; public class KeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory kx13ContextFactory) { public bool TryLocate( Expression> sourceKeySelector, - Expression> targetKeySelector, + Func targetKeySelector, Expression> sourceGuidSelector, - Expression> targetGuidSelector, + Func targetByGuidProvider, object? sourceKey, out TTargetKey targetId ) where TSource : class where TTarget : class { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var kx13Context = kx13ContextFactory.CreateDbContext(); var sourceType = typeof(TSource); @@ -42,17 +39,14 @@ public bool TryLocate( var sourcePredicate = Expression.Lambda>(sourceEquals, sourceKeySelector.Parameters[0]); var kx13Guid = kx13Context.Set().Where(sourcePredicate).Select(sourceGuidSelector).Single(); - var param = Expression.Parameter(typeof(TTarget), "t"); - var member = targetGuidSelector.Body as MemberExpression ?? throw new InvalidOperationException($"Expression SHALL NOT be other than member expression, expression: {targetGuidSelector}"); - var targetEquals = Expression.Equal( - Expression.MakeMemberAccess(param, member.Member), - Expression.Constant(kx13Guid, typeof(Guid)) - ); - var targetPredicate = Expression.Lambda>(targetEquals, param); + var target = targetByGuidProvider(kx13Guid); + if (target is null) + { + logger.LogWarning("Mapping {SourceFullType} primary key: {SourceId} failed, GUID {TargetGUID} not present in target instance", sourceType.FullName, sourceKey, kx13Guid); + return false; + } - var query = kxpContext.Set().Where(targetPredicate); - var selector = Expression.Lambda>(targetKeySelector.Body, targetKeySelector.Parameters[0]); - targetId = query.Select(selector).Single(); + targetId = targetKeySelector(target); return true; } catch (InvalidOperationException ioex) diff --git a/Migration.Tool.Core.KX13/Services/PrimaryKeyLocatorService.cs b/Migration.Tool.Core.KX13/Services/PrimaryKeyLocatorService.cs index 6050f84a..051bdade 100644 --- a/Migration.Tool.Core.KX13/Services/PrimaryKeyLocatorService.cs +++ b/Migration.Tool.Core.KX13/Services/PrimaryKeyLocatorService.cs @@ -1,23 +1,25 @@ using System.Linq.Expressions; - +using CMS.ContactManagement; +using CMS.ContentEngine; +using CMS.DataEngine; +using CMS.Globalization; +using CMS.Membership; +using CMS.Modules; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Migration.Tool.Common; using Migration.Tool.KX13.Context; -using Migration.Tool.KXP.Context; namespace Migration.Tool.Core.KX13.Services; public class PrimaryKeyLocatorService( ILogger logger, - IDbContextFactory kxpContextFactory, IDbContextFactory kx13ContextFactory) : IPrimaryKeyLocatorService { public IEnumerable SelectAll(Expression> keyNameSelector) { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var kx13Context = kx13ContextFactory.CreateDbContext(); var sourceType = typeof(T); @@ -28,12 +30,12 @@ public IEnumerable SelectAll(Expression new { x.UserId, x.UserGuid, x.UserName }).ToList(); - var targetUsers = kxpContext.CmsUsers.Select(x => new { x.UserId, x.UserName, x.UserGuid }).ToList(); + var targetUsers = UserInfo.Provider.Get().Select(x => new { x.UserID, x.UserName, x.UserGUID }).ToList(); var result = sourceUsers.Join(targetUsers, a => new CmsUserKey(a.UserGuid, a.UserName), - b => new CmsUserKey(b.UserGuid, b.UserName), - (a, b) => new SourceTargetKeyMapping(a.UserId, b.UserId), + b => new CmsUserKey(b.UserGUID, b.UserName), + (a, b) => new SourceTargetKeyMapping(a.UserId, b.UserID), new KeyEqualityComparerWithLambda((ak, bk) => (ak?.UserGuid == bk?.UserGuid || ak?.UserName == bk?.UserName) && ak != null && bk != null) ); @@ -50,14 +52,14 @@ public IEnumerable SelectAll(Expression c.ContactCreated) .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); - var target = kxpContext.OmContacts - .OrderBy(c => c.ContactCreated) - .Select(x => new { x.ContactId, x.ContactGuid }).ToList(); + var target = ContactInfo.Provider.Get() + .OrderBy(nameof(ContactInfo.ContactCreated)) + .Select(x => new { x.ContactID, x.ContactGUID }).ToList(); var result = source.Join(target, a => a.ContactGuid, - b => b.ContactGuid, - (a, b) => new SourceTargetKeyMapping(a.ContactId, b.ContactId) + b => b.ContactGUID, + (a, b) => new SourceTargetKeyMapping(a.ContactId, b.ContactID) ); foreach (var resultingMapping in result) @@ -71,12 +73,12 @@ public IEnumerable SelectAll(Expression new { x.StateId, x.StateName }).ToList(); - var target = kxpContext.CmsStates.Select(x => new { x.StateId, x.StateName }).ToList(); + var target = StateInfo.Provider.Get().Select(x => new { x.StateID, x.StateName }).ToList(); var result = source.Join(target, a => a.StateName, b => b.StateName, - (a, b) => new SourceTargetKeyMapping(a.StateId, b.StateId) + (a, b) => new SourceTargetKeyMapping(a.StateId, b.StateID) ); foreach (var resultingMapping in result) @@ -90,12 +92,12 @@ public IEnumerable SelectAll(Expression new { x.CountryId, x.CountryName }).ToList(); - var target = kxpContext.CmsCountries.Select(x => new { x.CountryId, x.CountryName }).ToList(); + var target = CountryInfo.Provider.Get().Select(x => new { x.CountryID, x.CountryName }).ToList(); var result = source.Join(target, a => a.CountryName, b => b.CountryName, - (a, b) => new SourceTargetKeyMapping(a.CountryId, b.CountryId) + (a, b) => new SourceTargetKeyMapping(a.CountryId, b.CountryID) ); foreach (var resultingMapping in result) @@ -111,7 +113,6 @@ public IEnumerable SelectAll(Expression(Expression> keyNameSelector, int sourceId, out int targetId) { - using var kxpContext = kxpContextFactory.CreateDbContext(); using var kx13Context = kx13ContextFactory.CreateDbContext(); var sourceType = typeof(T); @@ -121,63 +122,63 @@ public bool TryLocate(Expression> keyNameSelector, int source if (sourceType == typeof(KX13M.CmsResource)) { var kx13Guid = kx13Context.CmsResources.Where(c => c.ResourceId == sourceId).Select(x => x.ResourceGuid).Single(); - targetId = kxpContext.CmsResources.Where(x => x.ResourceGuid == kx13Guid).Select(x => x.ResourceId).Single(); + targetId = ResourceInfo.Provider.Get().WhereEquals(nameof(ResourceInfo.ResourceGUID), kx13Guid).Select(x => x.ResourceID).Single(); return true; } if (sourceType == typeof(KX13M.CmsClass)) { var kx13Guid = kx13Context.CmsClasses.Where(c => c.ClassId == sourceId).Select(x => x.ClassGuid).Single(); - targetId = kxpContext.CmsClasses.Where(x => x.ClassGuid == kx13Guid).Select(x => x.ClassId).Single(); + targetId = DataClassInfoProvider.GetClasses().Where(x => x.ClassGUID == kx13Guid).Select(x => x.ClassID).Single(); return true; } if (sourceType == typeof(KX13M.CmsUser)) { var kx13User = kx13Context.CmsUsers.Where(c => c.UserId == sourceId).Select(x => new { x.UserGuid, x.UserName }).Single(); - targetId = kxpContext.CmsUsers.Where(x => x.UserGuid == kx13User.UserGuid || x.UserName == kx13User.UserName).Select(x => x.UserId).Single(); + targetId = UserInfo.Provider.Get().WhereEquals(nameof(UserInfo.UserGUID), kx13User.UserGuid).Or().WhereEquals(nameof(UserInfo.UserName), kx13User.UserName).Select(x => x.UserID).Single(); return true; } if (sourceType == typeof(KX13M.CmsRole)) { var kx13User = kx13Context.CmsRoles.Where(c => c.RoleId == sourceId).Select(x => new { x.RoleGuid }).Single(); - targetId = kxpContext.CmsRoles.Where(x => x.RoleGuid == kx13User.RoleGuid).Select(x => x.RoleId).Single(); + targetId = RoleInfo.Provider.Get().WhereEquals(nameof(RoleInfo.RoleGUID), kx13User.RoleGuid).Select(x => x.RoleID).Single(); return true; } if (sourceType == typeof(KX13M.CmsSite)) { var kx13Guid = kx13Context.CmsSites.Where(c => c.SiteId == sourceId).Select(x => x.SiteGuid).Single(); - targetId = kxpContext.CmsChannels.Where(x => x.ChannelGuid == kx13Guid).Select(x => x.ChannelId).Single(); + targetId = ChannelInfo.Provider.Get().WhereEquals(nameof(ChannelInfo.ChannelGUID), kx13Guid).Select(x => x.ChannelID).Single(); return true; } if (sourceType == typeof(KX13M.CmsState)) { - string kx13CodeName = kx13Context.CmsStates.Where(c => c.StateId == sourceId).Select(x => x.StateName).Single(); - targetId = kxpContext.CmsStates.Where(x => x.StateName == kx13CodeName).Select(x => x.StateId).Single(); + string stateName = kx13Context.CmsStates.Where(c => c.StateId == sourceId).Select(x => x.StateName).Single(); + targetId = StateInfo.Provider.Get().WhereEquals(nameof(StateInfo.StateName), stateName).Select(x => x.StateID).Single(); return true; } if (sourceType == typeof(KX13M.CmsCountry)) { - string kx13CodeName = kx13Context.CmsCountries.Where(c => c.CountryId == sourceId).Select(x => x.CountryName).Single(); - targetId = kxpContext.CmsCountries.Where(x => x.CountryName == kx13CodeName).Select(x => x.CountryId).Single(); + string countryName = kx13Context.CmsCountries.Where(c => c.CountryId == sourceId).Select(x => x.CountryName).Single(); + targetId = CountryInfo.Provider.Get().WhereEquals(nameof(CountryInfo.CountryName), countryName).Select(x => x.CountryID).Single(); return true; } if (sourceType == typeof(KX13M.OmContactStatus)) { - string kx13Guid = kx13Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); - targetId = kxpContext.OmContactStatuses.Where(x => x.ContactStatusName == kx13Guid).Select(x => x.ContactStatusId).Single(); + string statusName = kx13Context.OmContactStatuses.Where(c => c.ContactStatusId == sourceId).Select(x => x.ContactStatusName).Single(); + targetId = ContactStatusInfo.Provider.Get().WhereEquals(nameof(ContactStatusInfo.ContactStatusName), statusName).Select(x => x.ContactStatusID).Single(); return true; } if (sourceType == typeof(KX13M.OmContact)) { - var kx13Guid = kx13Context.OmContacts.Where(c => c.ContactId == sourceId).Select(x => x.ContactGuid).Single(); - targetId = kxpContext.OmContacts.Where(x => x.ContactGuid == kx13Guid).Select(x => x.ContactId).Single(); + var contactGuid = kx13Context.OmContacts.Where(c => c.ContactId == sourceId).Select(x => x.ContactGuid).Single(); + targetId = ContactInfo.Provider.Get().WhereEquals(nameof(ContactInfo.ContactGUID), contactGuid).Select(x => x.ContactID).Single(); return true; } } From 4afdfbec2f35e3119850b468cb636bdc4c6b2630 Mon Sep 17 00:00:00 2001 From: akfakmot Date: Fri, 15 Nov 2024 19:24:24 +0100 Subject: [PATCH 09/10] Remove Migration.Tool.KXP project from solution Remove: Remove Migration.Tool.KXP project from solution --- Migration.Tool.CLI/Program.cs | 9 - Migration.Tool.KXP/Context/KxpContext.cs | 1270 ----------------- .../DependencyInjectionExtensions.cs | 22 - Migration.Tool.KXP/Migration.Tool.KXP.csproj | 30 - Migration.Tool.KXP/Models/CdMigration.cs | 23 - Migration.Tool.KXP/Models/CiFileMetadatum.cs | 21 - Migration.Tool.KXP/Models/CiMigration.cs | 23 - .../Models/CmsAlternativeForm.cs | 48 - .../Models/CmsApplicationPermission.cs | 31 - .../Models/CmsAutomationHistory.cs | 81 -- .../Models/CmsAutomationState.cs | 62 - .../Models/CmsAutomationTemplate.cs | 29 - Migration.Tool.KXP/Models/CmsChannel.cs | 45 - Migration.Tool.KXP/Models/CmsClass.cs | 96 -- Migration.Tool.KXP/Models/CmsConsent.cs | 33 - .../Models/CmsConsentAgreement.cs | 38 - .../Models/CmsConsentArchive.cs | 31 - Migration.Tool.KXP/Models/CmsContentFolder.cs | 62 - Migration.Tool.KXP/Models/CmsContentItem.cs | 66 - .../Models/CmsContentItemCommonDatum.cs | 48 - .../Models/CmsContentItemLanguageMetadatum.cs | 75 - .../Models/CmsContentItemReference.cs | 37 - .../Models/CmsContentItemTag.cs | 31 - .../Models/CmsContentLanguage.cs | 50 - .../Models/CmsContentTypeChannel.cs | 30 - .../Models/CmsContentWorkflow.cs | 29 - .../Models/CmsContentWorkflowContentType.cs | 30 - .../Models/CmsContentWorkflowStep.cs | 47 - .../Models/CmsContentWorkflowStepRole.cs | 30 - Migration.Tool.KXP/Models/CmsCountry.cs | 38 - Migration.Tool.KXP/Models/CmsCulture.cs | 39 - Migration.Tool.KXP/Models/CmsEmail.cs | 68 - .../Models/CmsEmailAttachment.cs | 38 - Migration.Tool.KXP/Models/CmsEventLog.cs | 44 - Migration.Tool.KXP/Models/CmsExternalLogin.cs | 28 - Migration.Tool.KXP/Models/CmsForm.cs | 53 - .../Models/CmsFormFeaturedField.cs | 36 - .../Models/CmsHeadlessChannel.cs | 43 - Migration.Tool.KXP/Models/CmsHeadlessItem.cs | 36 - Migration.Tool.KXP/Models/CmsHeadlessToken.cs | 57 - Migration.Tool.KXP/Models/CmsLicenseKey.cs | 25 - Migration.Tool.KXP/Models/CmsMacroIdentity.cs | 32 - Migration.Tool.KXP/Models/CmsMacroRule.cs | 40 - .../Models/CmsMacroRuleCategory.cs | 30 - .../Models/CmsMacroRuleMacroRuleCategory.cs | 30 - Migration.Tool.KXP/Models/CmsMember.cs | 32 - .../Models/CmsMemberExternalLogin.cs | 25 - .../Models/CmsObjectWorkflowTrigger.cs | 45 - .../Models/CmsPageTemplateConfiguration.cs | 29 - Migration.Tool.KXP/Models/CmsQuery.cs | 42 - Migration.Tool.KXP/Models/CmsResource.cs | 39 - .../Models/CmsResourceString.cs | 26 - .../Models/CmsResourceTranslation.cs | 32 - Migration.Tool.KXP/Models/CmsRole.cs | 38 - Migration.Tool.KXP/Models/CmsScheduledTask.cs | 73 - .../Models/CmsSettingsCategory.cs | 59 - Migration.Tool.KXP/Models/CmsSettingsKey.cs | 57 - Migration.Tool.KXP/Models/CmsSmartFolder.cs | 46 - Migration.Tool.KXP/Models/CmsState.cs | 43 - Migration.Tool.KXP/Models/CmsTag.cs | 50 - Migration.Tool.KXP/Models/CmsTaxonomy.cs | 30 - Migration.Tool.KXP/Models/CmsUser.cs | 112 -- .../Models/CmsUserMacroIdentity.cs | 34 - Migration.Tool.KXP/Models/CmsUserRole.cs | 30 - Migration.Tool.KXP/Models/CmsWebFarmServer.cs | 31 - .../Models/CmsWebFarmServerLog.cs | 20 - .../Models/CmsWebFarmServerMonitoring.cs | 17 - .../Models/CmsWebFarmServerTask.cs | 30 - Migration.Tool.KXP/Models/CmsWebFarmTask.cs | 41 - .../Models/CmsWebPageFormerUrlPath.cs | 46 - Migration.Tool.KXP/Models/CmsWebPageItem.cs | 61 - .../Models/CmsWebPageUrlPath.cs | 53 - .../Models/CmsWebsiteCaptchaSetting.cs | 28 - .../Models/CmsWebsiteChannel.cs | 52 - Migration.Tool.KXP/Models/CmsWorkflow.cs | 79 - .../Models/CmsWorkflowAction.cs | 64 - Migration.Tool.KXP/Models/CmsWorkflowStep.cs | 93 -- .../Models/CmsWorkflowTransition.cs | 45 - .../Models/EmailLibraryEmailBounce.cs | 22 - .../Models/EmailLibraryEmailChannel.cs | 40 - .../Models/EmailLibraryEmailChannelSender.cs | 33 - .../Models/EmailLibraryEmailConfiguration.cs | 59 - .../Models/EmailLibraryEmailLink.cs | 33 - .../EmailLibraryEmailMarketingRecipient.cs | 42 - .../Models/EmailLibraryEmailStatistic.cs | 42 - .../Models/EmailLibraryEmailStatisticsHit.cs | 37 - ...ailLibraryEmailSubscriptionConfirmation.cs | 37 - .../Models/EmailLibraryEmailTemplate.cs | 29 - .../EmailLibraryEmailTemplateContentType.cs | 30 - .../EmailLibraryRecipientListSetting.cs | 39 - .../Models/EmailLibrarySendConfiguration.cs | 38 - Migration.Tool.KXP/Models/MediaFile.cs | 70 - Migration.Tool.KXP/Models/MediaLibrary.cs | 36 - Migration.Tool.KXP/Models/OmAccount.cs | 113 -- Migration.Tool.KXP/Models/OmAccountContact.cs | 38 - Migration.Tool.KXP/Models/OmAccountStatus.cs | 23 - Migration.Tool.KXP/Models/OmActivity.cs | 76 - .../Models/OmActivityRecalculationQueue.cs | 15 - Migration.Tool.KXP/Models/OmActivityType.cs | 41 - Migration.Tool.KXP/Models/OmContact.cs | 136 -- .../OmContactChangeRecalculationQueue.cs | 21 - Migration.Tool.KXP/Models/OmContactGroup.cs | 45 - .../Models/OmContactGroupMember.cs | 35 - Migration.Tool.KXP/Models/OmContactRole.cs | 23 - Migration.Tool.KXP/Models/OmContactStatus.cs | 23 - Migration.Tool.KXP/Models/OmTrackedWebsite.cs | 34 - .../Models/OmVisitorToContact.cs | 26 - Migration.Tool.KXP/Models/TempFile.cs | 47 - .../Models/TempPageBuilderWidget.cs | 20 - .../Models/ViewCmsResourceStringJoined.cs | 43 - .../Models/ViewCmsResourceTranslatedJoined.cs | 27 - .../ViewOmAccountContactAccountJoined.cs | 31 - .../ViewOmAccountContactContactJoined.cs | 40 - .../Models/ViewOmAccountJoined.cs | 101 -- .../ViewOmContactGroupMemberAccountJoined.cs | 77 - Migration.Tool.KXP/genModel.ps1 | 13 - Migration.Tool.sln | 6 - 117 files changed, 6207 deletions(-) delete mode 100644 Migration.Tool.KXP/Context/KxpContext.cs delete mode 100644 Migration.Tool.KXP/DependencyInjectionExtensions.cs delete mode 100644 Migration.Tool.KXP/Migration.Tool.KXP.csproj delete mode 100644 Migration.Tool.KXP/Models/CdMigration.cs delete mode 100644 Migration.Tool.KXP/Models/CiFileMetadatum.cs delete mode 100644 Migration.Tool.KXP/Models/CiMigration.cs delete mode 100644 Migration.Tool.KXP/Models/CmsAlternativeForm.cs delete mode 100644 Migration.Tool.KXP/Models/CmsApplicationPermission.cs delete mode 100644 Migration.Tool.KXP/Models/CmsAutomationHistory.cs delete mode 100644 Migration.Tool.KXP/Models/CmsAutomationState.cs delete mode 100644 Migration.Tool.KXP/Models/CmsAutomationTemplate.cs delete mode 100644 Migration.Tool.KXP/Models/CmsChannel.cs delete mode 100644 Migration.Tool.KXP/Models/CmsClass.cs delete mode 100644 Migration.Tool.KXP/Models/CmsConsent.cs delete mode 100644 Migration.Tool.KXP/Models/CmsConsentAgreement.cs delete mode 100644 Migration.Tool.KXP/Models/CmsConsentArchive.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentFolder.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentItem.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentItemCommonDatum.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentItemLanguageMetadatum.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentItemReference.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentItemTag.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentLanguage.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentTypeChannel.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentWorkflow.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentWorkflowContentType.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentWorkflowStep.cs delete mode 100644 Migration.Tool.KXP/Models/CmsContentWorkflowStepRole.cs delete mode 100644 Migration.Tool.KXP/Models/CmsCountry.cs delete mode 100644 Migration.Tool.KXP/Models/CmsCulture.cs delete mode 100644 Migration.Tool.KXP/Models/CmsEmail.cs delete mode 100644 Migration.Tool.KXP/Models/CmsEmailAttachment.cs delete mode 100644 Migration.Tool.KXP/Models/CmsEventLog.cs delete mode 100644 Migration.Tool.KXP/Models/CmsExternalLogin.cs delete mode 100644 Migration.Tool.KXP/Models/CmsForm.cs delete mode 100644 Migration.Tool.KXP/Models/CmsFormFeaturedField.cs delete mode 100644 Migration.Tool.KXP/Models/CmsHeadlessChannel.cs delete mode 100644 Migration.Tool.KXP/Models/CmsHeadlessItem.cs delete mode 100644 Migration.Tool.KXP/Models/CmsHeadlessToken.cs delete mode 100644 Migration.Tool.KXP/Models/CmsLicenseKey.cs delete mode 100644 Migration.Tool.KXP/Models/CmsMacroIdentity.cs delete mode 100644 Migration.Tool.KXP/Models/CmsMacroRule.cs delete mode 100644 Migration.Tool.KXP/Models/CmsMacroRuleCategory.cs delete mode 100644 Migration.Tool.KXP/Models/CmsMacroRuleMacroRuleCategory.cs delete mode 100644 Migration.Tool.KXP/Models/CmsMember.cs delete mode 100644 Migration.Tool.KXP/Models/CmsMemberExternalLogin.cs delete mode 100644 Migration.Tool.KXP/Models/CmsObjectWorkflowTrigger.cs delete mode 100644 Migration.Tool.KXP/Models/CmsPageTemplateConfiguration.cs delete mode 100644 Migration.Tool.KXP/Models/CmsQuery.cs delete mode 100644 Migration.Tool.KXP/Models/CmsResource.cs delete mode 100644 Migration.Tool.KXP/Models/CmsResourceString.cs delete mode 100644 Migration.Tool.KXP/Models/CmsResourceTranslation.cs delete mode 100644 Migration.Tool.KXP/Models/CmsRole.cs delete mode 100644 Migration.Tool.KXP/Models/CmsScheduledTask.cs delete mode 100644 Migration.Tool.KXP/Models/CmsSettingsCategory.cs delete mode 100644 Migration.Tool.KXP/Models/CmsSettingsKey.cs delete mode 100644 Migration.Tool.KXP/Models/CmsSmartFolder.cs delete mode 100644 Migration.Tool.KXP/Models/CmsState.cs delete mode 100644 Migration.Tool.KXP/Models/CmsTag.cs delete mode 100644 Migration.Tool.KXP/Models/CmsTaxonomy.cs delete mode 100644 Migration.Tool.KXP/Models/CmsUser.cs delete mode 100644 Migration.Tool.KXP/Models/CmsUserMacroIdentity.cs delete mode 100644 Migration.Tool.KXP/Models/CmsUserRole.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebFarmServer.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebFarmServerLog.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebFarmServerMonitoring.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebFarmServerTask.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebFarmTask.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebPageFormerUrlPath.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebPageItem.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebPageUrlPath.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebsiteCaptchaSetting.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWebsiteChannel.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWorkflow.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWorkflowAction.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWorkflowStep.cs delete mode 100644 Migration.Tool.KXP/Models/CmsWorkflowTransition.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailBounce.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailChannel.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailChannelSender.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailConfiguration.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailLink.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailMarketingRecipient.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailStatistic.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailStatisticsHit.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailSubscriptionConfirmation.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailTemplate.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryEmailTemplateContentType.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibraryRecipientListSetting.cs delete mode 100644 Migration.Tool.KXP/Models/EmailLibrarySendConfiguration.cs delete mode 100644 Migration.Tool.KXP/Models/MediaFile.cs delete mode 100644 Migration.Tool.KXP/Models/MediaLibrary.cs delete mode 100644 Migration.Tool.KXP/Models/OmAccount.cs delete mode 100644 Migration.Tool.KXP/Models/OmAccountContact.cs delete mode 100644 Migration.Tool.KXP/Models/OmAccountStatus.cs delete mode 100644 Migration.Tool.KXP/Models/OmActivity.cs delete mode 100644 Migration.Tool.KXP/Models/OmActivityRecalculationQueue.cs delete mode 100644 Migration.Tool.KXP/Models/OmActivityType.cs delete mode 100644 Migration.Tool.KXP/Models/OmContact.cs delete mode 100644 Migration.Tool.KXP/Models/OmContactChangeRecalculationQueue.cs delete mode 100644 Migration.Tool.KXP/Models/OmContactGroup.cs delete mode 100644 Migration.Tool.KXP/Models/OmContactGroupMember.cs delete mode 100644 Migration.Tool.KXP/Models/OmContactRole.cs delete mode 100644 Migration.Tool.KXP/Models/OmContactStatus.cs delete mode 100644 Migration.Tool.KXP/Models/OmTrackedWebsite.cs delete mode 100644 Migration.Tool.KXP/Models/OmVisitorToContact.cs delete mode 100644 Migration.Tool.KXP/Models/TempFile.cs delete mode 100644 Migration.Tool.KXP/Models/TempPageBuilderWidget.cs delete mode 100644 Migration.Tool.KXP/Models/ViewCmsResourceStringJoined.cs delete mode 100644 Migration.Tool.KXP/Models/ViewCmsResourceTranslatedJoined.cs delete mode 100644 Migration.Tool.KXP/Models/ViewOmAccountContactAccountJoined.cs delete mode 100644 Migration.Tool.KXP/Models/ViewOmAccountContactContactJoined.cs delete mode 100644 Migration.Tool.KXP/Models/ViewOmAccountJoined.cs delete mode 100644 Migration.Tool.KXP/Models/ViewOmContactGroupMemberAccountJoined.cs delete mode 100644 Migration.Tool.KXP/genModel.ps1 diff --git a/Migration.Tool.CLI/Program.cs b/Migration.Tool.CLI/Program.cs index 237ab766..ccc4b5a9 100644 --- a/Migration.Tool.CLI/Program.cs +++ b/Migration.Tool.CLI/Program.cs @@ -17,10 +17,8 @@ using Migration.Tool.K11; using Migration.Tool.KX12; using Migration.Tool.KX13; -using Migration.Tool.KXP; using Migration.Tool.KXP.Api; using Migration.Tool.KXP.Api.Services.CmsClass; -using Migration.Tool.KXP.Context; using Migration.Tool.Source; using static Migration.Tool.Common.Helpers.ConsoleHelper; @@ -158,10 +156,6 @@ return; } - -services.UseKxpDbContext(settings); - - services.UseKxpApi(kxpApiSettings, settings.XbKDirPath); services.AddSingleton(settings); services.AddSingleton(); @@ -176,14 +170,11 @@ var commandParser = scope.ServiceProvider.GetRequiredService(); var mediatr = scope.ServiceProvider.GetRequiredService(); -var kxpContext = scope.ServiceProvider.GetRequiredService>().CreateDbContext(); var argsQ = new Queue(args); bool bypassDependencyCheck = false; var commands = commandParser.Parse(argsQ, ref bypassDependencyCheck); -kxpContext.Dispose(); - // sort commands commands = commands.OrderBy(x => x.Rank).ToList(); diff --git a/Migration.Tool.KXP/Context/KxpContext.cs b/Migration.Tool.KXP/Context/KxpContext.cs deleted file mode 100644 index 8b974f1d..00000000 --- a/Migration.Tool.KXP/Context/KxpContext.cs +++ /dev/null @@ -1,1270 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -using Migration.Tool.KXP.Models; - -namespace Migration.Tool.KXP.Context; - -public partial class KxpContext : DbContext -{ - public KxpContext() - { - } - - public KxpContext(DbContextOptions options) - : base(options) - { - } - - public virtual DbSet CdMigrations { get; set; } - - public virtual DbSet CiFileMetadata { get; set; } - - public virtual DbSet CiMigrations { get; set; } - - public virtual DbSet CmsAlternativeForms { get; set; } - - public virtual DbSet CmsApplicationPermissions { get; set; } - - public virtual DbSet CmsAutomationHistories { get; set; } - - public virtual DbSet CmsAutomationStates { get; set; } - - public virtual DbSet CmsAutomationTemplates { get; set; } - - public virtual DbSet CmsChannels { get; set; } - - public virtual DbSet CmsClasses { get; set; } - - public virtual DbSet CmsConsents { get; set; } - - public virtual DbSet CmsConsentAgreements { get; set; } - - public virtual DbSet CmsConsentArchives { get; set; } - - public virtual DbSet CmsContentFolders { get; set; } - - public virtual DbSet CmsContentItems { get; set; } - - public virtual DbSet CmsContentItemCommonData { get; set; } - - public virtual DbSet CmsContentItemLanguageMetadata { get; set; } - - public virtual DbSet CmsContentItemReferences { get; set; } - - public virtual DbSet CmsContentItemTags { get; set; } - - public virtual DbSet CmsContentLanguages { get; set; } - - public virtual DbSet CmsContentTypeChannels { get; set; } - - public virtual DbSet CmsContentWorkflows { get; set; } - - public virtual DbSet CmsContentWorkflowContentTypes { get; set; } - - public virtual DbSet CmsContentWorkflowSteps { get; set; } - - public virtual DbSet CmsContentWorkflowStepRoles { get; set; } - - public virtual DbSet CmsCountries { get; set; } - - public virtual DbSet CmsCultures { get; set; } - - public virtual DbSet CmsEmails { get; set; } - - public virtual DbSet CmsEmailAttachments { get; set; } - - public virtual DbSet CmsEventLogs { get; set; } - - public virtual DbSet CmsExternalLogins { get; set; } - - public virtual DbSet CmsForms { get; set; } - - public virtual DbSet CmsFormFeaturedFields { get; set; } - - public virtual DbSet CmsHeadlessChannels { get; set; } - - public virtual DbSet CmsHeadlessItems { get; set; } - - public virtual DbSet CmsHeadlessTokens { get; set; } - - public virtual DbSet CmsLicenseKeys { get; set; } - - public virtual DbSet CmsMacroIdentities { get; set; } - - public virtual DbSet CmsMacroRules { get; set; } - - public virtual DbSet CmsMacroRuleCategories { get; set; } - - public virtual DbSet CmsMacroRuleMacroRuleCategories { get; set; } - - public virtual DbSet CmsMembers { get; set; } - - public virtual DbSet CmsMemberExternalLogins { get; set; } - - public virtual DbSet CmsObjectWorkflowTriggers { get; set; } - - public virtual DbSet CmsPageTemplateConfigurations { get; set; } - - public virtual DbSet CmsQueries { get; set; } - - public virtual DbSet CmsResources { get; set; } - - public virtual DbSet CmsResourceStrings { get; set; } - - public virtual DbSet CmsResourceTranslations { get; set; } - - public virtual DbSet CmsRoles { get; set; } - - public virtual DbSet CmsScheduledTasks { get; set; } - - public virtual DbSet CmsSettingsCategories { get; set; } - - public virtual DbSet CmsSettingsKeys { get; set; } - - public virtual DbSet CmsSmartFolders { get; set; } - - public virtual DbSet CmsStates { get; set; } - - public virtual DbSet CmsTags { get; set; } - - public virtual DbSet CmsTaxonomies { get; set; } - - public virtual DbSet CmsUsers { get; set; } - - public virtual DbSet CmsUserMacroIdentities { get; set; } - - public virtual DbSet CmsUserRoles { get; set; } - - public virtual DbSet CmsWebFarmServers { get; set; } - - public virtual DbSet CmsWebFarmServerLogs { get; set; } - - public virtual DbSet CmsWebFarmServerMonitorings { get; set; } - - public virtual DbSet CmsWebFarmServerTasks { get; set; } - - public virtual DbSet CmsWebFarmTasks { get; set; } - - public virtual DbSet CmsWebPageFormerUrlPaths { get; set; } - - public virtual DbSet CmsWebPageItems { get; set; } - - public virtual DbSet CmsWebPageUrlPaths { get; set; } - - public virtual DbSet CmsWebsiteCaptchaSettings { get; set; } - - public virtual DbSet CmsWebsiteChannels { get; set; } - - public virtual DbSet CmsWorkflows { get; set; } - - public virtual DbSet CmsWorkflowActions { get; set; } - - public virtual DbSet CmsWorkflowSteps { get; set; } - - public virtual DbSet CmsWorkflowTransitions { get; set; } - - public virtual DbSet EmailLibraryEmailBounces { get; set; } - - public virtual DbSet EmailLibraryEmailChannels { get; set; } - - public virtual DbSet EmailLibraryEmailChannelSenders { get; set; } - - public virtual DbSet EmailLibraryEmailConfigurations { get; set; } - - public virtual DbSet EmailLibraryEmailLinks { get; set; } - - public virtual DbSet EmailLibraryEmailMarketingRecipients { get; set; } - - public virtual DbSet EmailLibraryEmailStatistics { get; set; } - - public virtual DbSet EmailLibraryEmailStatisticsHits { get; set; } - - public virtual DbSet EmailLibraryEmailSubscriptionConfirmations { get; set; } - - public virtual DbSet EmailLibraryEmailTemplates { get; set; } - - public virtual DbSet EmailLibraryEmailTemplateContentTypes { get; set; } - - public virtual DbSet EmailLibraryRecipientListSettings { get; set; } - - public virtual DbSet EmailLibrarySendConfigurations { get; set; } - - public virtual DbSet MediaFiles { get; set; } - - public virtual DbSet MediaLibraries { get; set; } - - public virtual DbSet OmAccounts { get; set; } - - public virtual DbSet OmAccountContacts { get; set; } - - public virtual DbSet OmAccountStatuses { get; set; } - - public virtual DbSet OmActivities { get; set; } - - public virtual DbSet OmActivityRecalculationQueues { get; set; } - - public virtual DbSet OmActivityTypes { get; set; } - - public virtual DbSet OmContacts { get; set; } - - public virtual DbSet OmContactChangeRecalculationQueues { get; set; } - - public virtual DbSet OmContactGroups { get; set; } - - public virtual DbSet OmContactGroupMembers { get; set; } - - public virtual DbSet OmContactRoles { get; set; } - - public virtual DbSet OmContactStatuses { get; set; } - - public virtual DbSet OmTrackedWebsites { get; set; } - - public virtual DbSet OmVisitorToContacts { get; set; } - - public virtual DbSet TempFiles { get; set; } - - public virtual DbSet TempPageBuilderWidgets { get; set; } - - public virtual DbSet ViewCmsResourceStringJoineds { get; set; } - - public virtual DbSet ViewCmsResourceTranslatedJoineds { get; set; } - - public virtual DbSet ViewOmAccountContactAccountJoineds { get; set; } - - public virtual DbSet ViewOmAccountContactContactJoineds { get; set; } - - public virtual DbSet ViewOmAccountJoineds { get; set; } - - public virtual DbSet ViewOmContactGroupMemberAccountJoineds { get; set; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.Property(e => e.DateApplied).HasDefaultValueSql("(sysdatetime())"); - entity.Property(e => e.RowsAffected).HasDefaultValueSql("(NULL)"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.FileHash).HasDefaultValue(""); - entity.Property(e => e.FileLocation).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.DateApplied).HasDefaultValueSql("(sysdatetime())"); - entity.Property(e => e.RowsAffected).HasDefaultValueSql("(NULL)"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.FormDisplayName).HasDefaultValue(""); - entity.Property(e => e.FormIsCustom).HasDefaultValue(false); - entity.Property(e => e.FormName).HasDefaultValue(""); - - entity.HasOne(d => d.FormClass).WithMany(p => p.CmsAlternativeFormFormClasses) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AlternativeForm_FormClassID_CMS_Class"); - - entity.HasOne(d => d.FormCoupledClass).WithMany(p => p.CmsAlternativeFormFormCoupledClasses).HasConstraintName("FK_CMS_AlternativeForm_FormCoupledClassID_CMS_Class"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ApplicationName).HasDefaultValue(""); - entity.Property(e => e.PermissionName).HasDefaultValue(""); - - entity.HasOne(d => d.Role).WithMany(p => p.CmsApplicationPermissions) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ApplicationPermission_RoleID_CMS_Role"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.HistoryRejected).HasDefaultValue(false); - entity.Property(e => e.HistoryStepDisplayName).HasDefaultValue(""); - - entity.HasOne(d => d.HistoryApprovedByUser).WithMany(p => p.CmsAutomationHistories).HasConstraintName("FK_CMS_AutomationHistory_HistoryApprovedByUserID"); - - entity.HasOne(d => d.HistoryState).WithMany(p => p.CmsAutomationHistories) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AutomationHistory_HistoryStateID"); - - entity.HasOne(d => d.HistoryStep).WithMany(p => p.CmsAutomationHistoryHistorySteps).HasConstraintName("FK_CMS_AutomationHistory_HistoryStepID"); - - entity.HasOne(d => d.HistoryTargetStep).WithMany(p => p.CmsAutomationHistoryHistoryTargetSteps).HasConstraintName("FK_CMS_AutomationHistory_HistoryTargetStepID"); - - entity.HasOne(d => d.HistoryWorkflow).WithMany(p => p.CmsAutomationHistories) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AutomationHistory_HistoryWorkflowID"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.StateStep).WithMany(p => p.CmsAutomationStates) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AutomationState_StateStepID"); - - entity.HasOne(d => d.StateUser).WithMany(p => p.CmsAutomationStates).HasConstraintName("FK_CMS_AutomationState_StateUserID_CMS_User"); - - entity.HasOne(d => d.StateWorkflow).WithMany(p => p.CmsAutomationStates) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AutomationState_StateWorkflowID"); - }); - - modelBuilder.Entity(entity => entity.Property(e => e.TemplateDisplayName).HasDefaultValue("")); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ChannelDisplayName).HasDefaultValue(""); - entity.Property(e => e.ChannelName).HasDefaultValue(""); - entity.Property(e => e.ChannelSize).HasDefaultValue("Standard"); - entity.Property(e => e.ChannelType).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ClassId).IsClustered(false); - - entity.HasIndex(e => new { e.ClassId, e.ClassName, e.ClassDisplayName }, "IX_CMS_Class_ClassID_ClassName_ClassDisplayName").IsClustered(); - - entity.HasIndex(e => e.ClassShortName, "IX_CMS_Class_ClassShortName") - .IsUnique() - .HasFilter("([ClassShortName] IS NOT NULL)"); - - entity.Property(e => e.ClassType).HasDefaultValue("Other"); - - entity.HasOne(d => d.ClassResource).WithMany(p => p.CmsClasses).HasConstraintName("FK_CMS_Class_ClassResourceID_CMS_Resource"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ConsentContent).HasDefaultValue(""); - entity.Property(e => e.ConsentDisplayName).HasDefaultValue(""); - entity.Property(e => e.ConsentHash).HasDefaultValue(""); - entity.Property(e => e.ConsentName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ConsentAgreementConsent).WithMany(p => p.CmsConsentAgreements) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ConsentAgreement_ConsentAgreementConsentID_CMS_Consent"); - - entity.HasOne(d => d.ConsentAgreementContact).WithMany(p => p.CmsConsentAgreements) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ConsentAgreement_ConsentAgreementContactID_OM_Contact"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ConsentArchiveContent).HasDefaultValue(""); - entity.Property(e => e.ConsentArchiveHash).HasDefaultValue(""); - - entity.HasOne(d => d.ConsentArchiveConsent).WithMany(p => p.CmsConsentArchives) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ConsentArchive_ConsentArchiveConsentID_CMS_Consent"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContentFolderDisplayName).HasDefaultValue(""); - entity.Property(e => e.ContentFolderName).HasDefaultValue(""); - - entity.HasOne(d => d.ContentFolderCreatedByUser).WithMany(p => p.CmsContentFolderContentFolderCreatedByUsers).HasConstraintName("FK_CMS_ContentFolder_ContentFolderCreatedByUserID_CMS_User"); - - entity.HasOne(d => d.ContentFolderModifiedByUser).WithMany(p => p.CmsContentFolderContentFolderModifiedByUsers).HasConstraintName("FK_CMS_ContentFolder_ContentFolderModifiedByUserID_CMS_User"); - - entity.HasOne(d => d.ContentFolderParentFolder).WithMany(p => p.InverseContentFolderParentFolder).HasConstraintName("FK_CMS_ContentFolder_ContentFolderParentFolderID_CMS_ContentFolder"); - }); - - modelBuilder.Entity(entity => - { - entity.HasIndex(e => e.ContentItemChannelId, "IX_CMS_ContentItem_ContentItemChannelID").HasFilter("([ContentItemChannelID] IS NOT NULL)"); - - entity.Property(e => e.ContentItemName).HasDefaultValue(""); - - entity.HasOne(d => d.ContentItemChannel).WithMany(p => p.CmsContentItems).HasConstraintName("FK_CMS_ContentItem_ContentItemChannelID"); - - entity.HasOne(d => d.ContentItemContentFolder).WithMany(p => p.CmsContentItems).HasConstraintName("FK_CMS_ContentItem_ContentItemContentFolderID_CMS_ContentFolder"); - - entity.HasOne(d => d.ContentItemContentType).WithMany(p => p.CmsContentItems).HasConstraintName("FK_CMS_ContentItem_ContentItemContentTypeID_CMS_Class"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ContentItemCommonDataContentItem).WithMany(p => p.CmsContentItemCommonData) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemCommonData_ContentItemCommonDataContentItemID_CMS_ContentItem"); - - entity.HasOne(d => d.ContentItemCommonDataContentLanguage).WithMany(p => p.CmsContentItemCommonData) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemCommonData_ContentItemCommonDataContentLanguageID_CMS_ContentLanguage"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContentItemLanguageMetadataDisplayName).HasDefaultValue(""); - - entity.HasOne(d => d.ContentItemLanguageMetadataContentItem).WithMany(p => p.CmsContentItemLanguageMetadata) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemLanguageMetadata_ContentItemLanguageMetadataContentItemID_CMS_ContentItem"); - - entity.HasOne(d => d.ContentItemLanguageMetadataContentLanguage).WithMany(p => p.CmsContentItemLanguageMetadata) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemLanguageMetadata_ContentItemLanguageMetadataContentLanguageID_CMS_ContentLanguage"); - - entity.HasOne(d => d.ContentItemLanguageMetadataContentWorkflowStep).WithMany(p => p.CmsContentItemLanguageMetadata) - .HasConstraintName("FK_CMS_ContentItemLanguageMetadata_ContentItemLanguageMetadataContentWorkflowStepID_CMS_ContentWorkflowStep"); - - entity.HasOne(d => d.ContentItemLanguageMetadataCreatedByUser).WithMany(p => p.CmsContentItemLanguageMetadatumContentItemLanguageMetadataCreatedByUsers) - .HasConstraintName("FK_CMS_ContentItemLanguageMetadata_CMS_ContentItemLanguageMetadataCreatedByUserID_CMS_User"); - - entity.HasOne(d => d.ContentItemLanguageMetadataModifiedByUser).WithMany(p => p.CmsContentItemLanguageMetadatumContentItemLanguageMetadataModifiedByUsers) - .HasConstraintName("FK_CMS_ContentItemLanguageMetadata_CMS_ContentItemLanguageMetadataModifiedByUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ContentItemReferenceSourceCommonData).WithMany(p => p.CmsContentItemReferences) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemReference_ContentItemReferenceSourceCommonDataID_CMS_ContentItemCommonData"); - - entity.HasOne(d => d.ContentItemReferenceTargetItem).WithMany(p => p.CmsContentItemReferences) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemReference_ContentItemReferenceTargetItemID_CMS_ContentItem"); - }); - - modelBuilder.Entity(entity => entity.HasOne(d => d.ContentItemTagContentItemLanguageMetadata).WithMany(p => p.CmsContentItemTags) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentItemTag_ContentItemTagContentItemLanguageMetadataID_CMS_ContentItemLanguageMetadata")); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContentLanguageCultureFormat).HasDefaultValue(""); - entity.Property(e => e.ContentLanguageDisplayName).HasDefaultValue(""); - entity.Property(e => e.ContentLanguageName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ContentTypeChannelChannel).WithMany(p => p.CmsContentTypeChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentTypeChannel_ContentTypeChannelChannelID_CMS_Channel"); - - entity.HasOne(d => d.ContentTypeChannelContentType).WithMany(p => p.CmsContentTypeChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentTypeChannel_ContentTypeChannelConentTypeID_CMS_Class"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContentWorkflowDisplayName).HasDefaultValue(""); - entity.Property(e => e.ContentWorkflowName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ContentWorkflowContentTypeContentType).WithMany(p => p.CmsContentWorkflowContentTypes) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentWorkflowContentType_ContentWorkflowContentTypeContentTypeID_CMS_Class"); - - entity.HasOne(d => d.ContentWorkflowContentTypeContentWorkflow).WithMany(p => p.CmsContentWorkflowContentTypes) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentWorkflowContentType_ContentWorkflowContentTypeContentWorkflowID_CMS_ContentWorkflow"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContentWorkflowStepDisplayName).HasDefaultValue(""); - entity.Property(e => e.ContentWorkflowStepIconClass).HasDefaultValue(""); - entity.Property(e => e.ContentWorkflowStepName).HasDefaultValue(""); - - entity.HasOne(d => d.ContentWorkflowStepWorkflow).WithMany(p => p.CmsContentWorkflowSteps) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentWorkflowStep_ContentWorkflowStepWorkflowID_CMS_ContentWorkflow"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ContentWorkflowStepRoleContentWorkflowStep).WithMany(p => p.CmsContentWorkflowStepRoles) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentWorkflowStepRole_ContentWorkflowStepRoleContentWorkflowStepID_CMS_ContentWorkflowStep"); - - entity.HasOne(d => d.ContentWorkflowStepRoleRole).WithMany(p => p.CmsContentWorkflowStepRoles) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ContentWorkflowStepRole_ContentWorkflowStepRoleRoleID_CMS_Role"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.CountryId).IsClustered(false); - - entity.HasIndex(e => e.CountryDisplayName, "IX_CMS_Country_CountryDisplayName").IsClustered(); - - entity.Property(e => e.CountryDisplayName).HasDefaultValue(""); - entity.Property(e => e.CountryLastModified).HasDefaultValueSql("('11/14/2013 1:43:04 PM')"); - entity.Property(e => e.CountryName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.CultureId).IsClustered(false); - - entity.HasIndex(e => e.CultureName, "IX_CMS_Culture_CultureName").IsClustered(); - - entity.Property(e => e.CultureIsUiculture).HasDefaultValue(false); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailFrom).HasDefaultValue(""); - entity.Property(e => e.EmailSubject).HasDefaultValue(""); - - entity.HasOne(d => d.EmailEmailConfiguration).WithMany(p => p.CmsEmails).HasConstraintName("FK_CMS_Email_EmailEmailConfigurationID_EmailLibrary_EmailConfiguration"); - - entity.HasMany(d => d.Attachments).WithMany(p => p.Emails) - .UsingEntity>( - "CmsAttachmentForEmail", - r => r.HasOne().WithMany() - .HasForeignKey("AttachmentId") - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AttachmentForEmail_AttachmentID_CMS_EmailAttachment"), - l => l.HasOne().WithMany() - .HasForeignKey("EmailId") - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_AttachmentForEmail_EmailID_CMS_Email"), - j => - { - j.HasKey("EmailId", "AttachmentId"); - j.ToTable("CMS_AttachmentForEmail"); - j.HasIndex(new[] { "AttachmentId" }, "IX_CMS_AttachmentForEmail_AttachmentID"); - j.IndexerProperty("EmailId").HasColumnName("EmailID"); - j.IndexerProperty("AttachmentId").HasColumnName("AttachmentID"); - }); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EventCode).HasDefaultValue(""); - entity.Property(e => e.EventMachineName).HasDefaultValue(""); - entity.Property(e => e.EventTime).HasDefaultValueSql("('4/21/2015 8:21:43 AM')"); - entity.Property(e => e.EventType).HasDefaultValue(""); - entity.Property(e => e.EventUrl).HasDefaultValue(""); - entity.Property(e => e.EventUrlReferrer).HasDefaultValue(""); - entity.Property(e => e.Ipaddress).HasDefaultValue(""); - entity.Property(e => e.Source).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.IdentityKey).HasDefaultValue(""); - entity.Property(e => e.LoginProvider).HasDefaultValue(""); - - entity.HasOne(d => d.User).WithMany(p => p.CmsExternalLogins) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ExternalLogin_UserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.FormId).IsClustered(false); - - entity.HasIndex(e => e.FormDisplayName, "IX_CMS_Form_FormDisplayName").IsClustered(); - - entity.Property(e => e.FormDisplayName).HasDefaultValue(""); - entity.Property(e => e.FormLastModified).HasDefaultValueSql("('9/17/2012 1:37:08 PM')"); - entity.Property(e => e.FormLogActivity).HasDefaultValue(true); - entity.Property(e => e.FormName).HasDefaultValue(""); - entity.Property(e => e.FormSubmitButtonText).HasDefaultValue(""); - - entity.HasOne(d => d.FormClass).WithMany(p => p.CmsForms) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_Form_FormClassID_CMS_Class"); - - entity.HasMany(d => d.Roles).WithMany(p => p.Forms) - .UsingEntity>( - "CmsFormRole", - r => r.HasOne().WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_FormRole_RoleID_CMS_Role"), - l => l.HasOne().WithMany() - .HasForeignKey("FormId") - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_FormRole_FormID_CMS_Form"), - j => - { - j.HasKey("FormId", "RoleId"); - j.ToTable("CMS_FormRole"); - j.HasIndex(new[] { "RoleId" }, "IX_CMS_FormRole_RoleID"); - j.IndexerProperty("FormId").HasColumnName("FormID"); - j.IndexerProperty("RoleId").HasColumnName("RoleID"); - }); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.FormFeaturedFieldEnabled).HasDefaultValue(true); - entity.Property(e => e.FormFeaturedFieldMapping).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.HeadlessChannelChannel).WithMany(p => p.CmsHeadlessChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_HeadlessChannel_HeadlessChannelChannelID_CMS_Channel"); - - entity.HasOne(d => d.HeadlessChannelPrimaryContentLanguage).WithMany(p => p.CmsHeadlessChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_HeadlessChannel_HeadlessChannelPrimaryContentLanguageID_CMS_ContentLanguage"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.HeadlessItemName).HasDefaultValue(""); - - entity.HasOne(d => d.HeadlessItemContentItem).WithMany(p => p.CmsHeadlessItems) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_HeadlessItem_HeadlessItemContentItemID_CMS_ContentItem"); - - entity.HasOne(d => d.HeadlessItemHeadlessChannel).WithMany(p => p.CmsHeadlessItems) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_HeadlessItem_HeadlessItemHeadlessChannelID_CMS_HeadlessChannel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.HeadlessTokenAccessType).HasDefaultValue("Published"); - entity.Property(e => e.HeadlessTokenDisplayName).HasDefaultValue(""); - entity.Property(e => e.HeadlessTokenEnabled).HasDefaultValue(true); - entity.Property(e => e.HeadlessTokenHash).HasDefaultValue(""); - - entity.HasOne(d => d.HeadlessTokenCreatedByUser).WithMany(p => p.CmsHeadlessTokenHeadlessTokenCreatedByUsers).HasConstraintName("FK_CMS_HeadlessToken_HeadlessTokenCreatedByUserID_CMS_User"); - - entity.HasOne(d => d.HeadlessTokenHeadlessChannel).WithMany(p => p.CmsHeadlessTokens) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_HeadlessToken_HeadlessTokenHeadlessChannelID_CMS_HeadlessChannel"); - - entity.HasOne(d => d.HeadlessTokenModifiedByUser).WithMany(p => p.CmsHeadlessTokenHeadlessTokenModifiedByUsers).HasConstraintName("FK_CMS_HeadlessToken_HeadlessTokenModifiedByUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.LicenseKeyId).IsClustered(false); - - entity.HasIndex(e => e.LicenseDomain, "IX_CMS_LicenseKey_LicenseDomain").IsClustered(); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.MacroIdentityName).HasDefaultValue(""); - - entity.HasOne(d => d.MacroIdentityEffectiveUser).WithMany(p => p.CmsMacroIdentities).HasConstraintName("FK_CMS_MacroIdentity_MacroIdentityEffectiveUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.MacroRuleCondition).HasDefaultValue(""); - entity.Property(e => e.MacroRuleDisplayName).HasDefaultValue(""); - entity.Property(e => e.MacroRuleEnabled).HasDefaultValue(true); - entity.Property(e => e.MacroRuleIsCustom).HasDefaultValue(false); - entity.Property(e => e.MacroRuleLastModified).HasDefaultValue(new DateTime(2012, 1, 5, 8, 46, 33, 0, DateTimeKind.Unspecified)); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.MacroRuleCategory).WithMany(p => p.CmsMacroRuleMacroRuleCategories) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_MacroRuleMacroRuleCategory_MacroRuleCategoryID_CMS_MacroRuleMacroRuleCategory"); - - entity.HasOne(d => d.MacroRule).WithMany(p => p.CmsMacroRuleMacroRuleCategories) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_MacroRuleMacroRuleCategory_MacroRuleID_CMS_MacroRule"); - }); - - modelBuilder.Entity(entity => - { - entity.HasIndex(e => e.MemberEmail, "IX_CMS_Member_MemberEmail") - .IsUnique() - .HasFilter("([MemberEmail] IS NOT NULL AND [MemberEmail]<>'')"); - - entity.HasIndex(e => e.MemberName, "IX_CMS_Member_MemberName") - .IsUnique() - .HasFilter("([MemberName] IS NOT NULL AND [MemberName]<>'')"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.MemberExternalLoginIdentityKey).HasDefaultValue(""); - entity.Property(e => e.MemberExternalLoginLoginProvider).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.TriggerDisplayName).HasDefaultValue(""); - entity.Property(e => e.TriggerObjectType).HasDefaultValue(""); - - entity.HasOne(d => d.TriggerWorkflow).WithMany(p => p.CmsObjectWorkflowTriggers) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ObjectWorkflowTrigger_TriggerWorkflowID"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.PageTemplateConfigurationIcon).HasDefaultValue("xp-layout"); - entity.Property(e => e.PageTemplateConfigurationName).HasDefaultValue(""); - entity.Property(e => e.PageTemplateConfigurationTemplate).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.QueryIsCustom).HasDefaultValue(false); - entity.Property(e => e.QueryName).HasDefaultValue(""); - - entity.HasOne(d => d.Class).WithMany(p => p.CmsQueries).HasConstraintName("FK_CMS_Query_ClassID_CMS_Class"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ResourceId).IsClustered(false); - - entity.HasIndex(e => e.ResourceDisplayName, "IX_CMS_Resource_ResourceDisplayName").IsClustered(); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.TranslationCulture).WithMany(p => p.CmsResourceTranslations) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ResourceTranslation_TranslationCultureID_CMS_Culture"); - - entity.HasOne(d => d.TranslationString).WithMany(p => p.CmsResourceTranslations) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_ResourceTranslation_TranslationStringID_CMS_ResourceString"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.TaskExecutingServerName).HasDefaultValue(""); - entity.Property(e => e.TaskInterval).HasDefaultValue(""); - - entity.HasOne(d => d.TaskUser).WithMany(p => p.CmsScheduledTasks).HasConstraintName("FK_CMS_ScheduledTask_TaskUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.CategoryId).IsClustered(false); - - entity.HasIndex(e => e.CategoryOrder, "IX_CMS_SettingsCategory_CategoryOrder").IsClustered(); - - entity.Property(e => e.CategoryDisplayName).HasDefaultValue(""); - entity.Property(e => e.CategoryIsCustom).HasDefaultValue(false); - entity.Property(e => e.CategoryIsGroup).HasDefaultValue(false); - - entity.HasOne(d => d.CategoryParent).WithMany(p => p.InverseCategoryParent).HasConstraintName("FK_CMS_SettingsCategory_CMS_SettingsCategory1"); - - entity.HasOne(d => d.CategoryResource).WithMany(p => p.CmsSettingsCategories).HasConstraintName("FK_CMS_SettingsCategory_CategoryResourceID_CMS_Resource"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.KeyDisplayName).HasDefaultValue(""); - entity.Property(e => e.KeyExplanationText).HasDefaultValue(""); - entity.Property(e => e.KeyIsCustom).HasDefaultValue(false); - entity.Property(e => e.KeyIsHidden).HasDefaultValue(false); - entity.Property(e => e.KeyName).HasDefaultValue(""); - entity.Property(e => e.KeyType).HasDefaultValue(""); - - entity.HasOne(d => d.KeyCategory).WithMany(p => p.CmsSettingsKeys).HasConstraintName("FK_CMS_SettingsKey_KeyCategoryID_CMS_SettingsCategory"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.SmartFolderDisplayName).HasDefaultValue(""); - entity.Property(e => e.SmartFolderFilter).HasDefaultValue(""); - entity.Property(e => e.SmartFolderName).HasDefaultValue(""); - - entity.HasOne(d => d.SmartFolderCreatedByUser).WithMany(p => p.CmsSmartFolderSmartFolderCreatedByUsers).HasConstraintName("FK_CMS_SmartFolder_SmartFolderCreatedByUserID_CMS_User"); - - entity.HasOne(d => d.SmartFolderModifiedByUser).WithMany(p => p.CmsSmartFolderSmartFolderModifiedByUsers).HasConstraintName("FK_CMS_SmartFolder_SmartFolderModifiedByUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.StateId).IsClustered(false); - - entity.HasIndex(e => e.StateDisplayName, "IX_CMS_State_CountryID_StateDisplayName").IsClustered(); - - entity.Property(e => e.StateDisplayName).HasDefaultValue(""); - entity.Property(e => e.StateName).HasDefaultValue(""); - - entity.HasOne(d => d.Country).WithMany(p => p.CmsStates) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_State_CountryID_CMS_Country"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.TagName).HasDefaultValue(""); - entity.Property(e => e.TagTitle).HasDefaultValue(""); - - entity.HasOne(d => d.TagParent).WithMany(p => p.InverseTagParent).HasConstraintName("FK_CMS_Tag_TagParentID_CMS_Tag"); - - entity.HasOne(d => d.TagTaxonomy).WithMany(p => p.CmsTags) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_Tag_TagTaxonomyID_CMS_Taxonomy"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.TaxonomyName).HasDefaultValue(""); - entity.Property(e => e.TaxonomyTitle).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasIndex(e => e.Email, "IX_CMS_User_Email") - .IsUnique() - .HasFilter("([Email] IS NOT NULL AND [Email]<>'')"); - - entity.Property(e => e.UserName).HasDefaultValue(""); - entity.Property(e => e.UserPassword).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.UserMacroIdentityMacroIdentity).WithMany(p => p.CmsUserMacroIdentities).HasConstraintName("FK_CMS_UserMacroIdentity_UserMacroIdentityMacroIdentityID_CMS_MacroIdentity"); - - entity.HasOne(d => d.UserMacroIdentityUser).WithOne(p => p.CmsUserMacroIdentity) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_UserMacroIdentity_UserMacroIdentityUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.Role).WithMany(p => p.CmsUserRoles) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_UserRole_RoleID_CMS_Role"); - - entity.HasOne(d => d.User).WithMany(p => p.CmsUserRoles) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_UserRole_UserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ServerDisplayName).HasDefaultValue(""); - entity.Property(e => e.ServerLastModified).HasDefaultValueSql("('9/17/2013 12:18:06 PM')"); - entity.Property(e => e.ServerName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => entity.Property(e => e.LogCode).HasDefaultValue("")); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.Server).WithMany(p => p.CmsWebFarmServerTasks) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebFarmServerTask_ServerID_CMS_WebFarmServer"); - - entity.HasOne(d => d.Task).WithMany(p => p.CmsWebFarmServerTasks) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebFarmServerTask_TaskID_CMS_WebFarmTask"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.TaskGuid).HasDefaultValue(new Guid("00000000-0000-0000-0000-000000000000")); - entity.Property(e => e.TaskIsMemory).HasDefaultValue(false); - entity.Property(e => e.TaskType).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.WebPageFormerUrlPath).HasDefaultValue(""); - entity.Property(e => e.WebPageFormerUrlPathHash).HasDefaultValue(""); - - entity.HasOne(d => d.WebPageFormerUrlPathContentLanguage).WithMany(p => p.CmsWebPageFormerUrlPaths) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageFormerUrlPath_WebPageFormerUrlPathContentLanguageID_CMS_ContentLanguage"); - - entity.HasOne(d => d.WebPageFormerUrlPathWebPageItem).WithMany(p => p.CmsWebPageFormerUrlPaths) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageFormerUrlPath_WebPageFormerUrlPathWebPageItemID_CMS_WebPageItem"); - - entity.HasOne(d => d.WebPageFormerUrlPathWebsiteChannel).WithMany(p => p.CmsWebPageFormerUrlPaths) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageFormerUrlPath_WebPageFormerUrlPathWebsiteChannelID_CMS_WebsiteChannel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.WebPageItemName).HasDefaultValue(""); - entity.Property(e => e.WebPageItemTreePath).HasDefaultValue(""); - - entity.HasOne(d => d.WebPageItemContentItem).WithMany(p => p.CmsWebPageItems).HasConstraintName("FK_CMS_WebPageItem_WebPageItemContentItemID_CMS_ContentItem"); - - entity.HasOne(d => d.WebPageItemParent).WithMany(p => p.InverseWebPageItemParent).HasConstraintName("FK_CMS_WebPageItem_WebPageItemParentID_CMS_WebPageItem"); - - entity.HasOne(d => d.WebPageItemWebsiteChannel).WithMany(p => p.CmsWebPageItems) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageItem_WebPageItemWebsiteChannelID_CMS_WebsiteChannel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.WebPageUrlPath).HasDefaultValue(""); - entity.Property(e => e.WebPageUrlPathHash).HasDefaultValue(""); - entity.Property(e => e.WebPageUrlPathIsLatest).HasDefaultValue(true); - - entity.HasOne(d => d.WebPageUrlPathContentLanguage).WithMany(p => p.CmsWebPageUrlPaths) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageUrlPath_WebPageUrlPathContentLanguageID_CMS_ContentLanguage"); - - entity.HasOne(d => d.WebPageUrlPathWebPageItem).WithMany(p => p.CmsWebPageUrlPaths) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageUrlPath_WebPageUrlPathWebPageItemID_CMS_WebPageItem"); - - entity.HasOne(d => d.WebPageUrlPathWebsiteChannel).WithMany(p => p.CmsWebPageUrlPaths) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebPageUrlPath_WebPageUrlPathWebsiteChannelID_CMS_WebsiteChannel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.WebsiteCaptchaSettingsReCaptchaSecretKey).HasDefaultValue(""); - entity.Property(e => e.WebsiteCaptchaSettingsReCaptchaSiteKey).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.WebsiteChannelDefaultCookieLevel).HasDefaultValue(1000); - entity.Property(e => e.WebsiteChannelDomain).HasDefaultValue(""); - entity.Property(e => e.WebsiteChannelStoreFormerUrls).HasDefaultValue(true); - - entity.HasOne(d => d.WebsiteChannelChannel).WithMany(p => p.CmsWebsiteChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebsiteChannel_WebsiteChannelChannelID_CMS_Channel"); - - entity.HasOne(d => d.WebsiteChannelPrimaryContentLanguage).WithMany(p => p.CmsWebsiteChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WebsiteChannel_WebsiteChannelPrimaryContentLanguageID_CMS_ContentLanguage"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.WorkflowId).IsClustered(false); - - entity.HasIndex(e => e.WorkflowDisplayName, "IX_CMS_Workflow_WorkflowDisplayName").IsClustered(); - - entity.Property(e => e.WorkflowAutoPublishChanges).HasDefaultValue(false); - entity.Property(e => e.WorkflowDisplayName).HasDefaultValue(""); - entity.Property(e => e.WorkflowEnabled).HasDefaultValue(true); - entity.Property(e => e.WorkflowName).HasDefaultValue(""); - entity.Property(e => e.WorkflowSendApproveEmails).HasDefaultValue(true); - entity.Property(e => e.WorkflowSendArchiveEmails).HasDefaultValue(true); - entity.Property(e => e.WorkflowSendPublishEmails).HasDefaultValue(true); - entity.Property(e => e.WorkflowSendReadyForApprovalEmails).HasDefaultValue(true); - entity.Property(e => e.WorkflowSendRejectEmails).HasDefaultValue(true); - entity.Property(e => e.WorkflowUseCheckinCheckout).HasDefaultValue(false); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ActionEnabled).HasDefaultValue(true); - - entity.HasOne(d => d.ActionResource).WithMany(p => p.CmsWorkflowActions).HasConstraintName("FK_CMS_WorkflowAction_ActionResourceID"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.StepAllowPublish).HasDefaultValue(false); - entity.Property(e => e.StepAllowReject).HasDefaultValue(true); - - entity.HasOne(d => d.StepAction).WithMany(p => p.CmsWorkflowSteps).HasConstraintName("FK_CMS_WorkflowStep_StepActionID"); - - entity.HasOne(d => d.StepWorkflow).WithMany(p => p.CmsWorkflowSteps) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WorkflowStep_StepWorkflowID"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.TransitionEndStep).WithMany(p => p.CmsWorkflowTransitionTransitionEndSteps) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WorkflowTransition_TransitionEndStepID_CMS_WorkflowStep"); - - entity.HasOne(d => d.TransitionStartStep).WithMany(p => p.CmsWorkflowTransitionTransitionStartSteps) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WorkflowTransition_TransitionStartStepID_CMS_WorkflowStep"); - - entity.HasOne(d => d.TransitionWorkflow).WithMany(p => p.CmsWorkflowTransitions) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_CMS_WorkflowTransition_TransitionWorkflowID_CMS_Workflow"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailChannelSendingDomain).HasDefaultValue(""); - entity.Property(e => e.EmailChannelServiceDomain).HasDefaultValue(""); - - entity.HasOne(d => d.EmailChannelChannel).WithMany(p => p.EmailLibraryEmailChannels) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailChannel_EmailChannelChannelID_CMS_Channel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailChannelSenderDisplayName).HasDefaultValue(""); - entity.Property(e => e.EmailChannelSenderName).HasDefaultValue(""); - - entity.HasOne(d => d.EmailChannelSenderEmailChannel).WithMany(p => p.EmailLibraryEmailChannelSenders) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailChannelSender_EmailChannelSenderEmailChannelID_EmailLibrary_EmailChannel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailConfigurationName).HasDefaultValue(""); - entity.Property(e => e.EmailConfigurationPurpose).HasDefaultValue("Regular"); - - entity.HasOne(d => d.EmailConfigurationContentItem).WithMany(p => p.EmailLibraryEmailConfigurations).HasConstraintName("FK_EmailLibrary_EmailConfiguration_EmailConfigurationContentItemID_CMS_ContentItem"); - - entity.HasOne(d => d.EmailConfigurationEmailChannel).WithMany(p => p.EmailLibraryEmailConfigurations).HasConstraintName("FK_EmailLibrary_EmailConfiguration_EmailConfigurationEmailChannelID_EmailLibrary_EmailChannel"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailLinkDescription).HasDefaultValue(""); - entity.Property(e => e.EmailLinkTarget).HasDefaultValue(""); - - entity.HasOne(d => d.EmailLinkEmailConfiguration).WithMany(p => p.EmailLibraryEmailLinks) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailLink_EmailLinkEmailConfigurationID_EmailLibrary_EmailConfiguration"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailMarketingRecipientContactEmail).HasDefaultValue(""); - - entity.HasOne(d => d.EmailMarketingRecipientContact).WithMany(p => p.EmailLibraryEmailMarketingRecipients) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailMarketingRecipient_EmailMarketingRecipientContactID_OM_Contact"); - - entity.HasOne(d => d.EmailMarketingRecipientEmailConfiguration).WithMany(p => p.EmailLibraryEmailMarketingRecipients) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailMarketingRecipient_EmailMarketingRecipientEmailConfigurationID_EmailLibrary_EmailConfiguration"); - }); - - modelBuilder.Entity(entity => entity.HasOne(d => d.EmailStatisticsEmailConfiguration).WithMany(p => p.EmailLibraryEmailStatistics) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailStatistics_EmailStatisticsEmailConfigurationID_EmailLibrary_EmailConfiguration")); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.EmailStatisticsHitsEmailConfiguration).WithMany(p => p.EmailLibraryEmailStatisticsHits) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailStatisticsHits_EmailStatisticsHitsEmailConfigurationID_EmailLibrary_EmailConfiguration"); - - entity.HasOne(d => d.EmailStatisticsHitsEmailLink).WithMany(p => p.EmailLibraryEmailStatisticsHits).HasConstraintName("FK_EmailLibrary_EmailStatisticsHits_EmailStatisticsHitsEmailLinkID_EmailLibrary_EmailLink"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.EmailSubscriptionConfirmationContact).WithMany(p => p.EmailLibraryEmailSubscriptionConfirmations) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailSubscriptionConfirmation_EmailSubscriptionConfirmationContactID_OM_Contact"); - - entity.HasOne(d => d.EmailSubscriptionConfirmationRecipientList).WithMany(p => p.EmailLibraryEmailSubscriptionConfirmations) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailSubscriptionConfirmation_EmailSubscriptionConfirmationRecipientListID_OM_ContactGroup"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.EmailTemplateCode).HasDefaultValue(""); - entity.Property(e => e.EmailTemplateDisplayName).HasDefaultValue(""); - entity.Property(e => e.EmailTemplateName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.EmailTemplateContentTypeContentType).WithMany(p => p.EmailLibraryEmailTemplateContentTypes) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailTemplateContentType_EmailTemplateContentTypeContentTypeID_CMS_Class"); - - entity.HasOne(d => d.EmailTemplateContentTypeEmailTemplate).WithMany(p => p.EmailLibraryEmailTemplateContentTypes) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_EmailTemplateContentType_EmailTemplateContentTypeEmailTemplateID_EmailLibrary_EmailTemplate"); - }); - - modelBuilder.Entity(entity => entity.HasOne(d => d.RecipientListSettingsRecipientList).WithMany(p => p.EmailLibraryRecipientListSettings) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_RecipientListSettings_RecipientListSettingsRecipientListID_OM_ContactGroup")); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.SendConfigurationEmailConfiguration).WithOne(p => p.EmailLibrarySendConfiguration) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_SendConfiguration_SendConfigurationEmailConfigurationID_EmailLibrary_EmailConfiguration"); - - entity.HasOne(d => d.SendConfigurationRecipientList).WithMany(p => p.EmailLibrarySendConfigurations) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_EmailLibrary_SendConfiguration_SendConfigurationRecipientListID_OM_ContactGroup"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.FileId).IsClustered(false); - - entity.HasIndex(e => e.FilePath, "IX_Media_File_FilePath").IsClustered(); - - entity.Property(e => e.FileCreatedWhen).HasDefaultValue(new DateTime(2008, 11, 11, 16, 10, 0, 0, DateTimeKind.Unspecified)); - entity.Property(e => e.FileModifiedWhen).HasDefaultValue(new DateTime(2008, 11, 11, 16, 11, 15, 0, DateTimeKind.Unspecified)); - entity.Property(e => e.FileTitle).HasDefaultValue(""); - - entity.HasOne(d => d.FileCreatedByUser).WithMany(p => p.MediaFileFileCreatedByUsers).HasConstraintName("FK_Media_File_FileCreatedByUserID_CMS_User"); - - entity.HasOne(d => d.FileLibrary).WithMany(p => p.MediaFiles) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_Media_File_FileLibraryID_Media_Library"); - - entity.HasOne(d => d.FileModifiedByUser).WithMany(p => p.MediaFileFileModifiedByUsers).HasConstraintName("FK_Media_File_FileModifiedByUserID_CMS_User"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.LibraryId).IsClustered(false); - - entity.HasIndex(e => e.LibraryDisplayName, "IX_Media_Library_LibraryDisplayName").IsClustered(); - - entity.Property(e => e.LibraryName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.AccountCountry).WithMany(p => p.OmAccounts).HasConstraintName("FK_OM_Account_CMS_Country"); - - entity.HasOne(d => d.AccountOwnerUser).WithMany(p => p.OmAccounts).HasConstraintName("FK_OM_Account_CMS_User"); - - entity.HasOne(d => d.AccountPrimaryContact).WithMany(p => p.OmAccountAccountPrimaryContacts).HasConstraintName("FK_OM_Account_OM_Contact_PrimaryContact"); - - entity.HasOne(d => d.AccountSecondaryContact).WithMany(p => p.OmAccountAccountSecondaryContacts).HasConstraintName("FK_OM_Account_OM_Contact_SecondaryContact"); - - entity.HasOne(d => d.AccountState).WithMany(p => p.OmAccounts).HasConstraintName("FK_OM_Account_CMS_State"); - - entity.HasOne(d => d.AccountStatus).WithMany(p => p.OmAccounts).HasConstraintName("FK_OM_Account_OM_AccountStatus"); - - entity.HasOne(d => d.AccountSubsidiaryOf).WithMany(p => p.InverseAccountSubsidiaryOf).HasConstraintName("FK_OM_Account_OM_Account_SubsidiaryOf"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.Account).WithMany(p => p.OmAccountContacts) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_OM_AccountContact_OM_Account"); - - entity.HasOne(d => d.Contact).WithMany(p => p.OmAccountContacts) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_OM_AccountContact_OM_Contact"); - - entity.HasOne(d => d.ContactRole).WithMany(p => p.OmAccountContacts).HasConstraintName("FK_OM_AccountContact_OM_ContactRole"); - }); - - modelBuilder.Entity(entity => - { - entity.HasOne(d => d.ActivityChannel).WithMany(p => p.OmActivities).HasConstraintName("FK_OM_Activity_ActivityChannelID_CMS_Channel"); - - entity.HasOne(d => d.ActivityLanguage).WithMany(p => p.OmActivities).HasConstraintName("FK_OM_Activity_ActivityLanguageID_CMS_ContentLanguage"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ActivityTypeEnabled).HasDefaultValue(true); - entity.Property(e => e.ActivityTypeIsCustom).HasDefaultValue(true); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContactCreated).HasDefaultValue(new DateTime(2011, 3, 5, 10, 51, 13, 0, DateTimeKind.Unspecified)); - entity.Property(e => e.ContactMonitored).HasDefaultValue(false); - entity.Property(e => e.ContactSalesForceLeadReplicationDisabled).HasDefaultValue(false); - entity.Property(e => e.ContactSalesForceLeadReplicationRequired).HasDefaultValue(false); - - entity.HasOne(d => d.ContactCountry).WithMany(p => p.OmContacts).HasConstraintName("FK_OM_Contact_CMS_Country"); - - entity.HasOne(d => d.ContactOwnerUser).WithMany(p => p.OmContacts).HasConstraintName("FK_OM_Contact_CMS_User"); - - entity.HasOne(d => d.ContactState).WithMany(p => p.OmContacts).HasConstraintName("FK_OM_Contact_CMS_State"); - - entity.HasOne(d => d.ContactStatus).WithMany(p => p.OmContacts).HasConstraintName("FK_OM_Contact_OM_ContactStatus"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ContactGroupId).HasName("PK_CMS_ContactGroup"); - - entity.Property(e => e.ContactGroupIsRecipientList).HasDefaultValue(false); - entity.Property(e => e.ContactGroupName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContactGroupMemberFromCondition).HasDefaultValue(false); - entity.Property(e => e.ContactGroupMemberFromManual).HasDefaultValue(false); - - entity.HasOne(d => d.ContactGroupMemberContactGroup).WithMany(p => p.OmContactGroupMembers) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_OM_ContactGroupMembers_OM_ContactGroup"); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContactRoleDisplayName).HasDefaultValue(""); - entity.Property(e => e.ContactRoleName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.ContactStatusDisplayName).HasDefaultValue(""); - entity.Property(e => e.ContactStatusName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.TrackedWebsiteDisplayName).HasDefaultValue(""); - entity.Property(e => e.TrackedWebsiteEnabled).HasDefaultValue(false); - entity.Property(e => e.TrackedWebsiteName).HasDefaultValue(""); - entity.Property(e => e.TrackedWebsiteUrl).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => entity.HasOne(d => d.VisitorToContactContact).WithMany(p => p.OmVisitorToContacts) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("FK_OM_VisitorToContact_OM_Contact_Cascade")); - - modelBuilder.Entity(entity => - { - entity.Property(e => e.FileDirectory).HasDefaultValue(""); - entity.Property(e => e.FileExtension).HasDefaultValue(""); - entity.Property(e => e.FileLastModified).HasDefaultValueSql("('6/29/2010 1:57:54 PM')"); - entity.Property(e => e.FileMimeType).HasDefaultValue(""); - entity.Property(e => e.FileName).HasDefaultValue(""); - }); - - modelBuilder.Entity(entity => entity.ToView("View_CMS_ResourceString_Joined")); - - modelBuilder.Entity(entity => entity.ToView("View_CMS_ResourceTranslated_Joined")); - - modelBuilder.Entity(entity => entity.ToView("View_OM_AccountContact_AccountJoined")); - - modelBuilder.Entity(entity => entity.ToView("View_OM_AccountContact_ContactJoined")); - - modelBuilder.Entity(entity => entity.ToView("View_OM_Account_Joined")); - - modelBuilder.Entity(entity => entity.ToView("View_OM_ContactGroupMember_AccountJoined")); - - OnModelCreatingPartial(modelBuilder); - } - - partial void OnModelCreatingPartial(ModelBuilder modelBuilder); -} diff --git a/Migration.Tool.KXP/DependencyInjectionExtensions.cs b/Migration.Tool.KXP/DependencyInjectionExtensions.cs deleted file mode 100644 index 73958296..00000000 --- a/Migration.Tool.KXP/DependencyInjectionExtensions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Diagnostics; - -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; - -using Migration.Tool.Common; -using Migration.Tool.KXP.Context; - -namespace Migration.Tool.KXP; - -public static class DependencyInjectionExtensions -{ - public static IServiceCollection UseKxpDbContext(this IServiceCollection services, ToolConfiguration toolConfiguration) - { - services.AddDbContextFactory(options => - { - Debug.Assert(toolConfiguration.XbKConnectionString != null, "toolConfiguration.XbKConnectionString != null"); - options.UseSqlServer(toolConfiguration.XbKConnectionString); - }); - return services; - } -} diff --git a/Migration.Tool.KXP/Migration.Tool.KXP.csproj b/Migration.Tool.KXP/Migration.Tool.KXP.csproj deleted file mode 100644 index 103f315f..00000000 --- a/Migration.Tool.KXP/Migration.Tool.KXP.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - Migration.Tool.KXP - Migration.Tool.KXP - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - diff --git a/Migration.Tool.KXP/Models/CdMigration.cs b/Migration.Tool.KXP/Models/CdMigration.cs deleted file mode 100644 index a00b7c17..00000000 --- a/Migration.Tool.KXP/Models/CdMigration.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CD_Migration")] -[Index("MigrationName", Name = "IX_CD_Migration_MigrationName", IsUnique = true)] -public class CdMigration -{ - [Key] - [Column("MigrationID")] - public int MigrationId { get; set; } - - [StringLength(255)] - public string MigrationName { get; set; } = null!; - - [Precision(3)] - public DateTime DateApplied { get; set; } - - public int? RowsAffected { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CiFileMetadatum.cs b/Migration.Tool.KXP/Models/CiFileMetadatum.cs deleted file mode 100644 index 0fbf5ff4..00000000 --- a/Migration.Tool.KXP/Models/CiFileMetadatum.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CI_FileMetadata")] -[Index("FileLocation", Name = "UQ_CI_FileMetadata_FileLocation", IsUnique = true)] -public class CiFileMetadatum -{ - [Key] - [Column("FileMetadataID")] - public int FileMetadataId { get; set; } - - [StringLength(260)] - public string FileLocation { get; set; } = null!; - - [StringLength(32)] - public string FileHash { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CiMigration.cs b/Migration.Tool.KXP/Models/CiMigration.cs deleted file mode 100644 index 363f46b1..00000000 --- a/Migration.Tool.KXP/Models/CiMigration.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CI_Migration")] -[Index("MigrationName", Name = "IX_CI_Migration_MigrationName", IsUnique = true)] -public class CiMigration -{ - [Key] - [Column("MigrationID")] - public int MigrationId { get; set; } - - [StringLength(255)] - public string MigrationName { get; set; } = null!; - - [Precision(3)] - public DateTime DateApplied { get; set; } - - public int? RowsAffected { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsAlternativeForm.cs b/Migration.Tool.KXP/Models/CmsAlternativeForm.cs deleted file mode 100644 index 6242ba22..00000000 --- a/Migration.Tool.KXP/Models/CmsAlternativeForm.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_AlternativeForm")] -[Index("FormClassId", "FormName", Name = "IX_CMS_AlternativeForm_FormClassID_FormName")] -[Index("FormCoupledClassId", Name = "IX_CMS_AlternativeForm_FormCoupledClassID")] -public class CmsAlternativeForm -{ - [Key] - [Column("FormID")] - public int FormId { get; set; } - - [StringLength(100)] - public string FormDisplayName { get; set; } = null!; - - [StringLength(50)] - public string FormName { get; set; } = null!; - - [Column("FormClassID")] - public int FormClassId { get; set; } - - public string? FormDefinition { get; set; } - - [Column("FormGUID")] - public Guid FormGuid { get; set; } - - public DateTime FormLastModified { get; set; } - - [Column("FormCoupledClassID")] - public int? FormCoupledClassId { get; set; } - - [StringLength(400)] - public string? FormCustomizedColumns { get; set; } - - public bool? FormIsCustom { get; set; } - - [ForeignKey("FormClassId")] - [InverseProperty("CmsAlternativeFormFormClasses")] - public virtual CmsClass FormClass { get; set; } = null!; - - [ForeignKey("FormCoupledClassId")] - [InverseProperty("CmsAlternativeFormFormCoupledClasses")] - public virtual CmsClass? FormCoupledClass { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsApplicationPermission.cs b/Migration.Tool.KXP/Models/CmsApplicationPermission.cs deleted file mode 100644 index 03d18990..00000000 --- a/Migration.Tool.KXP/Models/CmsApplicationPermission.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ApplicationPermission")] -[Index("RoleId", Name = "IX_CMS_ApplicationPermission_RoleID")] -[Index("RoleId", "PermissionName", "ApplicationName", Name = "IX_CMS_ApplicationPermission_RoleID_PermissionName_ApplicationName", IsUnique = true)] -public class CmsApplicationPermission -{ - [Key] - [Column("ApplicationPermissionID")] - public int ApplicationPermissionId { get; set; } - - [Column("RoleID")] - public int RoleId { get; set; } - - [StringLength(100)] - public string ApplicationName { get; set; } = null!; - - [StringLength(50)] - public string PermissionName { get; set; } = null!; - - public Guid ApplicationPermissionGuid { get; set; } - - [ForeignKey("RoleId")] - [InverseProperty("CmsApplicationPermissions")] - public virtual CmsRole Role { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsAutomationHistory.cs b/Migration.Tool.KXP/Models/CmsAutomationHistory.cs deleted file mode 100644 index 358ade96..00000000 --- a/Migration.Tool.KXP/Models/CmsAutomationHistory.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_AutomationHistory")] -[Index("HistoryApprovedByUserId", Name = "IX_CMS_AutomationHistory_HistoryApprovedByUserID")] -[Index("HistoryApprovedWhen", Name = "IX_CMS_AutomationHistory_HistoryApprovedWhen")] -[Index("HistoryStateId", Name = "IX_CMS_AutomationHistory_HistoryStateID")] -[Index("HistoryStepId", Name = "IX_CMS_AutomationHistory_HistoryStepID")] -[Index("HistoryTargetStepId", Name = "IX_CMS_AutomationHistory_HistoryTargetStepID")] -[Index("HistoryWorkflowId", Name = "IX_CMS_AutomationHistory_HistoryWorkflowID")] -public class CmsAutomationHistory -{ - [Key] - [Column("HistoryID")] - public int HistoryId { get; set; } - - [Column("HistoryStepID")] - public int? HistoryStepId { get; set; } - - [StringLength(440)] - public string? HistoryStepName { get; set; } - - [StringLength(450)] - public string HistoryStepDisplayName { get; set; } = null!; - - public int? HistoryStepType { get; set; } - - [Column("HistoryTargetStepID")] - public int? HistoryTargetStepId { get; set; } - - [StringLength(440)] - public string? HistoryTargetStepName { get; set; } - - [StringLength(450)] - public string? HistoryTargetStepDisplayName { get; set; } - - public int? HistoryTargetStepType { get; set; } - - [Column("HistoryApprovedByUserID")] - public int? HistoryApprovedByUserId { get; set; } - - public DateTime? HistoryApprovedWhen { get; set; } - - public string? HistoryComment { get; set; } - - public int? HistoryTransitionType { get; set; } - - [Column("HistoryWorkflowID")] - public int HistoryWorkflowId { get; set; } - - public bool? HistoryRejected { get; set; } - - public bool HistoryWasRejected { get; set; } - - [Column("HistoryStateID")] - public int HistoryStateId { get; set; } - - [ForeignKey("HistoryApprovedByUserId")] - [InverseProperty("CmsAutomationHistories")] - public virtual CmsUser? HistoryApprovedByUser { get; set; } - - [ForeignKey("HistoryStateId")] - [InverseProperty("CmsAutomationHistories")] - public virtual CmsAutomationState HistoryState { get; set; } = null!; - - [ForeignKey("HistoryStepId")] - [InverseProperty("CmsAutomationHistoryHistorySteps")] - public virtual CmsWorkflowStep? HistoryStep { get; set; } - - [ForeignKey("HistoryTargetStepId")] - [InverseProperty("CmsAutomationHistoryHistoryTargetSteps")] - public virtual CmsWorkflowStep? HistoryTargetStep { get; set; } - - [ForeignKey("HistoryWorkflowId")] - [InverseProperty("CmsAutomationHistories")] - public virtual CmsWorkflow HistoryWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsAutomationState.cs b/Migration.Tool.KXP/Models/CmsAutomationState.cs deleted file mode 100644 index 58936389..00000000 --- a/Migration.Tool.KXP/Models/CmsAutomationState.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_AutomationState")] -[Index("StateObjectId", "StateObjectType", Name = "IX_CMS_AutomationState_StateObjectID_StateObjectType")] -[Index("StateStepId", Name = "IX_CMS_AutomationState_StateStepID")] -[Index("StateUserId", Name = "IX_CMS_AutomationState_StateUserID")] -[Index("StateWorkflowId", Name = "IX_CMS_AutomationState_StateWorkflowID")] -public class CmsAutomationState -{ - [Key] - [Column("StateID")] - public int StateId { get; set; } - - [Column("StateStepID")] - public int StateStepId { get; set; } - - [Column("StateObjectID")] - public int StateObjectId { get; set; } - - [StringLength(100)] - public string StateObjectType { get; set; } = null!; - - [StringLength(450)] - public string? StateActionStatus { get; set; } - - public DateTime? StateCreated { get; set; } - - public DateTime? StateLastModified { get; set; } - - [Column("StateWorkflowID")] - public int StateWorkflowId { get; set; } - - public int? StateStatus { get; set; } - - [Column("StateUserID")] - public int? StateUserId { get; set; } - - [Column("StateGUID")] - public Guid StateGuid { get; set; } - - public string? StateCustomData { get; set; } - - [InverseProperty("HistoryState")] - public virtual ICollection CmsAutomationHistories { get; set; } = new List(); - - [ForeignKey("StateStepId")] - [InverseProperty("CmsAutomationStates")] - public virtual CmsWorkflowStep StateStep { get; set; } = null!; - - [ForeignKey("StateUserId")] - [InverseProperty("CmsAutomationStates")] - public virtual CmsUser? StateUser { get; set; } - - [ForeignKey("StateWorkflowId")] - [InverseProperty("CmsAutomationStates")] - public virtual CmsWorkflow StateWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsAutomationTemplate.cs b/Migration.Tool.KXP/Models/CmsAutomationTemplate.cs deleted file mode 100644 index 32c14872..00000000 --- a/Migration.Tool.KXP/Models/CmsAutomationTemplate.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_AutomationTemplate")] -[Index("TemplateDisplayName", Name = "IX_CMS_AutomationTemplate_TemplateDisplayName")] -public class CmsAutomationTemplate -{ - [Key] - [Column("TemplateID")] - public int TemplateId { get; set; } - - [StringLength(250)] - public string TemplateDisplayName { get; set; } = null!; - - public string? TemplateDescription { get; set; } - - [StringLength(200)] - public string? TemplateIconClass { get; set; } - - public string? TemplateConfiguration { get; set; } - - public Guid TemplateGuid { get; set; } - - public DateTime TemplateLastModified { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsChannel.cs b/Migration.Tool.KXP/Models/CmsChannel.cs deleted file mode 100644 index ca849793..00000000 --- a/Migration.Tool.KXP/Models/CmsChannel.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Channel")] -public class CmsChannel -{ - [Key] - [Column("ChannelID")] - public int ChannelId { get; set; } - - [StringLength(200)] - public string ChannelDisplayName { get; set; } = null!; - - [StringLength(200)] - public string ChannelName { get; set; } = null!; - - [StringLength(200)] - public string ChannelType { get; set; } = null!; - - [Column("ChannelGUID")] - public Guid ChannelGuid { get; set; } - - [StringLength(20)] - public string ChannelSize { get; set; } = null!; - - [InverseProperty("ContentItemChannel")] - public virtual ICollection CmsContentItems { get; set; } = new List(); - - [InverseProperty("ContentTypeChannelChannel")] - public virtual ICollection CmsContentTypeChannels { get; set; } = new List(); - - [InverseProperty("HeadlessChannelChannel")] - public virtual ICollection CmsHeadlessChannels { get; set; } = new List(); - - [InverseProperty("WebsiteChannelChannel")] - public virtual ICollection CmsWebsiteChannels { get; set; } = new List(); - - [InverseProperty("EmailChannelChannel")] - public virtual ICollection EmailLibraryEmailChannels { get; set; } = new List(); - - [InverseProperty("ActivityChannel")] - public virtual ICollection OmActivities { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsClass.cs b/Migration.Tool.KXP/Models/CmsClass.cs deleted file mode 100644 index ecad1def..00000000 --- a/Migration.Tool.KXP/Models/CmsClass.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Class")] -[Index("ClassName", Name = "IX_CMS_Class_ClassName", IsUnique = true)] -[Index("ClassName", "ClassGuid", Name = "IX_CMS_Class_ClassName_ClassGUID")] -[Index("ClassResourceId", Name = "IX_CMS_Class_ClassResourceID")] -public class CmsClass -{ - [Key] - [Column("ClassID")] - public int ClassId { get; set; } - - [StringLength(100)] - public string ClassDisplayName { get; set; } = null!; - - [StringLength(100)] - public string ClassName { get; set; } = null!; - - public string ClassXmlSchema { get; set; } = null!; - - public string ClassFormDefinition { get; set; } = null!; - - [StringLength(100)] - public string? ClassTableName { get; set; } - - public bool? ClassShowTemplateSelection { get; set; } - - public DateTime ClassLastModified { get; set; } - - [Column("ClassGUID")] - public Guid ClassGuid { get; set; } - - public string? ClassContactMapping { get; set; } - - public bool? ClassContactOverwriteEnabled { get; set; } - - [StringLength(100)] - public string? ClassConnectionString { get; set; } - - [StringLength(100)] - public string? ClassDefaultObjectType { get; set; } - - [Column("ClassResourceID")] - public int? ClassResourceId { get; set; } - - public string? ClassCodeGenerationSettings { get; set; } - - [StringLength(200)] - public string? ClassIconClass { get; set; } - - public bool ClassHasUnmanagedDbSchema { get; set; } - - [StringLength(10)] - public string ClassType { get; set; } = null!; - - [StringLength(10)] - public string? ClassContentTypeType { get; set; } - - public bool? ClassWebPageHasUrl { get; set; } - - [StringLength(100)] - public string? ClassShortName { get; set; } - - [ForeignKey("ClassResourceId")] - [InverseProperty("CmsClasses")] - public virtual CmsResource? ClassResource { get; set; } - - [InverseProperty("FormClass")] - public virtual ICollection CmsAlternativeFormFormClasses { get; set; } = new List(); - - [InverseProperty("FormCoupledClass")] - public virtual ICollection CmsAlternativeFormFormCoupledClasses { get; set; } = new List(); - - [InverseProperty("ContentItemContentType")] - public virtual ICollection CmsContentItems { get; set; } = new List(); - - [InverseProperty("ContentTypeChannelContentType")] - public virtual ICollection CmsContentTypeChannels { get; set; } = new List(); - - [InverseProperty("ContentWorkflowContentTypeContentType")] - public virtual ICollection CmsContentWorkflowContentTypes { get; set; } = new List(); - - [InverseProperty("FormClass")] - public virtual ICollection CmsForms { get; set; } = new List(); - - [InverseProperty("Class")] - public virtual ICollection CmsQueries { get; set; } = new List(); - - [InverseProperty("EmailTemplateContentTypeContentType")] - public virtual ICollection EmailLibraryEmailTemplateContentTypes { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsConsent.cs b/Migration.Tool.KXP/Models/CmsConsent.cs deleted file mode 100644 index 9567bdc4..00000000 --- a/Migration.Tool.KXP/Models/CmsConsent.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Consent")] -public class CmsConsent -{ - [Key] - [Column("ConsentID")] - public int ConsentId { get; set; } - - [StringLength(200)] - public string ConsentDisplayName { get; set; } = null!; - - [StringLength(200)] - public string ConsentName { get; set; } = null!; - - public string ConsentContent { get; set; } = null!; - - public Guid ConsentGuid { get; set; } - - public DateTime ConsentLastModified { get; set; } - - [StringLength(100)] - public string ConsentHash { get; set; } = null!; - - [InverseProperty("ConsentAgreementConsent")] - public virtual ICollection CmsConsentAgreements { get; set; } = new List(); - - [InverseProperty("ConsentArchiveConsent")] - public virtual ICollection CmsConsentArchives { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsConsentAgreement.cs b/Migration.Tool.KXP/Models/CmsConsentAgreement.cs deleted file mode 100644 index 2e1f5e75..00000000 --- a/Migration.Tool.KXP/Models/CmsConsentAgreement.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ConsentAgreement")] -[Index("ConsentAgreementContactId", "ConsentAgreementConsentId", Name = "IX_CMS_ConsentAgreement_ConsentAgreementContactID_ConsentAgreementConsentID")] -public class CmsConsentAgreement -{ - [Key] - [Column("ConsentAgreementID")] - public int ConsentAgreementId { get; set; } - - public Guid ConsentAgreementGuid { get; set; } - - public bool ConsentAgreementRevoked { get; set; } - - [Column("ConsentAgreementContactID")] - public int ConsentAgreementContactId { get; set; } - - [Column("ConsentAgreementConsentID")] - public int ConsentAgreementConsentId { get; set; } - - [StringLength(100)] - public string? ConsentAgreementConsentHash { get; set; } - - public DateTime ConsentAgreementTime { get; set; } - - [ForeignKey("ConsentAgreementConsentId")] - [InverseProperty("CmsConsentAgreements")] - public virtual CmsConsent ConsentAgreementConsent { get; set; } = null!; - - [ForeignKey("ConsentAgreementContactId")] - [InverseProperty("CmsConsentAgreements")] - public virtual OmContact ConsentAgreementContact { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsConsentArchive.cs b/Migration.Tool.KXP/Models/CmsConsentArchive.cs deleted file mode 100644 index 19d7daa7..00000000 --- a/Migration.Tool.KXP/Models/CmsConsentArchive.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ConsentArchive")] -[Index("ConsentArchiveConsentId", Name = "IX_ConsentArchive_ConsentArchiveConsentID")] -public class CmsConsentArchive -{ - [Key] - [Column("ConsentArchiveID")] - public int ConsentArchiveId { get; set; } - - public Guid ConsentArchiveGuid { get; set; } - - public DateTime ConsentArchiveLastModified { get; set; } - - [Column("ConsentArchiveConsentID")] - public int ConsentArchiveConsentId { get; set; } - - [StringLength(100)] - public string ConsentArchiveHash { get; set; } = null!; - - public string ConsentArchiveContent { get; set; } = null!; - - [ForeignKey("ConsentArchiveConsentId")] - [InverseProperty("CmsConsentArchives")] - public virtual CmsConsent ConsentArchiveConsent { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentFolder.cs b/Migration.Tool.KXP/Models/CmsContentFolder.cs deleted file mode 100644 index a0dfe09a..00000000 --- a/Migration.Tool.KXP/Models/CmsContentFolder.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentFolder")] -[Index("ContentFolderCreatedByUserId", Name = "IX_CMS_ContentFolder_ContentFolderCreatedByUserID")] -[Index("ContentFolderParentFolderId", Name = "IX_CMS_ContentFolder_ContentFolderDisplayName_ContentFolderParentID")] -[Index("ContentFolderGuid", Name = "IX_CMS_ContentFolder_ContentFolderGUID_Unique", IsUnique = true)] -[Index("ContentFolderModifiedByUserId", Name = "IX_CMS_ContentFolder_ContentFolderModifiedByUserID")] -[Index("ContentFolderParentFolderId", Name = "IX_CMS_ContentFolder_ContentFolderParentFolderID")] -public class CmsContentFolder -{ - [Key] - [Column("ContentFolderID")] - public int ContentFolderId { get; set; } - - [Column("ContentFolderGUID")] - public Guid ContentFolderGuid { get; set; } - - [StringLength(50)] - public string ContentFolderName { get; set; } = null!; - - [StringLength(50)] - public string ContentFolderDisplayName { get; set; } = null!; - - [StringLength(1020)] - public string? ContentFolderTreePath { get; set; } - - public DateTime ContentFolderCreatedWhen { get; set; } - - [Column("ContentFolderCreatedByUserID")] - public int? ContentFolderCreatedByUserId { get; set; } - - public DateTime ContentFolderModifiedWhen { get; set; } - - [Column("ContentFolderModifiedByUserID")] - public int? ContentFolderModifiedByUserId { get; set; } - - [Column("ContentFolderParentFolderID")] - public int? ContentFolderParentFolderId { get; set; } - - [InverseProperty("ContentItemContentFolder")] - public virtual ICollection CmsContentItems { get; set; } = new List(); - - [ForeignKey("ContentFolderCreatedByUserId")] - [InverseProperty("CmsContentFolderContentFolderCreatedByUsers")] - public virtual CmsUser? ContentFolderCreatedByUser { get; set; } - - [ForeignKey("ContentFolderModifiedByUserId")] - [InverseProperty("CmsContentFolderContentFolderModifiedByUsers")] - public virtual CmsUser? ContentFolderModifiedByUser { get; set; } - - [ForeignKey("ContentFolderParentFolderId")] - [InverseProperty("InverseContentFolderParentFolder")] - public virtual CmsContentFolder? ContentFolderParentFolder { get; set; } - - [InverseProperty("ContentFolderParentFolder")] - public virtual ICollection InverseContentFolderParentFolder { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsContentItem.cs b/Migration.Tool.KXP/Models/CmsContentItem.cs deleted file mode 100644 index edf047b5..00000000 --- a/Migration.Tool.KXP/Models/CmsContentItem.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentItem")] -[Index("ContentItemContentFolderId", Name = "IX_CMS_ContentItem_ContentItemContentFolderID")] -[Index("ContentItemContentTypeId", Name = "IX_CMS_ContentItem_ContentItemContentTypeID")] -[Index("ContentItemName", Name = "IX_CMS_ContentItem_ContentItemName", IsUnique = true)] -public class CmsContentItem -{ - [Key] - [Column("ContentItemID")] - public int ContentItemId { get; set; } - - [Column("ContentItemGUID")] - public Guid ContentItemGuid { get; set; } - - [StringLength(100)] - public string ContentItemName { get; set; } = null!; - - public bool ContentItemIsReusable { get; set; } - - public bool ContentItemIsSecured { get; set; } - - [Column("ContentItemContentTypeID")] - public int? ContentItemContentTypeId { get; set; } - - [Column("ContentItemChannelID")] - public int? ContentItemChannelId { get; set; } - - [Column("ContentItemContentFolderID")] - public int? ContentItemContentFolderId { get; set; } - - [InverseProperty("ContentItemCommonDataContentItem")] - public virtual ICollection CmsContentItemCommonData { get; set; } = new List(); - - [InverseProperty("ContentItemLanguageMetadataContentItem")] - public virtual ICollection CmsContentItemLanguageMetadata { get; set; } = new List(); - - [InverseProperty("ContentItemReferenceTargetItem")] - public virtual ICollection CmsContentItemReferences { get; set; } = new List(); - - [InverseProperty("HeadlessItemContentItem")] - public virtual ICollection CmsHeadlessItems { get; set; } = new List(); - - [InverseProperty("WebPageItemContentItem")] - public virtual ICollection CmsWebPageItems { get; set; } = new List(); - - [ForeignKey("ContentItemChannelId")] - [InverseProperty("CmsContentItems")] - public virtual CmsChannel? ContentItemChannel { get; set; } - - [ForeignKey("ContentItemContentFolderId")] - [InverseProperty("CmsContentItems")] - public virtual CmsContentFolder? ContentItemContentFolder { get; set; } - - [ForeignKey("ContentItemContentTypeId")] - [InverseProperty("CmsContentItems")] - public virtual CmsClass? ContentItemContentType { get; set; } - - [InverseProperty("EmailConfigurationContentItem")] - public virtual ICollection EmailLibraryEmailConfigurations { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsContentItemCommonDatum.cs b/Migration.Tool.KXP/Models/CmsContentItemCommonDatum.cs deleted file mode 100644 index 811189c1..00000000 --- a/Migration.Tool.KXP/Models/CmsContentItemCommonDatum.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentItemCommonData")] -[Index("ContentItemCommonDataContentItemId", "ContentItemCommonDataContentLanguageId", "ContentItemCommonDataIsLatest", Name = "IX_CMS_ContentItemCommonData_ContentItemID_ContentLanguageID_IsLatest", IsUnique = true)] -[Index("ContentItemCommonDataContentItemId", "ContentItemCommonDataContentLanguageId", "ContentItemCommonDataVersionStatus", Name = "IX_CMS_ContentItemCommonData_ContentItemID_ContentLanguageID_VersionStatus", IsUnique = true)] -public class CmsContentItemCommonDatum -{ - [Key] - [Column("ContentItemCommonDataID")] - public int ContentItemCommonDataId { get; set; } - - [Column("ContentItemCommonDataGUID")] - public Guid ContentItemCommonDataGuid { get; set; } - - [Column("ContentItemCommonDataContentItemID")] - public int ContentItemCommonDataContentItemId { get; set; } - - [Column("ContentItemCommonDataContentLanguageID")] - public int ContentItemCommonDataContentLanguageId { get; set; } - - public int ContentItemCommonDataVersionStatus { get; set; } - - public bool ContentItemCommonDataIsLatest { get; set; } - - public string? ContentItemCommonDataPageBuilderWidgets { get; set; } - - public string? ContentItemCommonDataPageTemplateConfiguration { get; set; } - - public DateTime? ContentItemCommonDataFirstPublishedWhen { get; set; } - - public DateTime? ContentItemCommonDataLastPublishedWhen { get; set; } - - [InverseProperty("ContentItemReferenceSourceCommonData")] - public virtual ICollection CmsContentItemReferences { get; set; } = new List(); - - [ForeignKey("ContentItemCommonDataContentItemId")] - [InverseProperty("CmsContentItemCommonData")] - public virtual CmsContentItem ContentItemCommonDataContentItem { get; set; } = null!; - - [ForeignKey("ContentItemCommonDataContentLanguageId")] - [InverseProperty("CmsContentItemCommonData")] - public virtual CmsContentLanguage ContentItemCommonDataContentLanguage { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentItemLanguageMetadatum.cs b/Migration.Tool.KXP/Models/CmsContentItemLanguageMetadatum.cs deleted file mode 100644 index d0ee48d7..00000000 --- a/Migration.Tool.KXP/Models/CmsContentItemLanguageMetadatum.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentItemLanguageMetadata")] -[Index("ContentItemLanguageMetadataContentItemId", "ContentItemLanguageMetadataContentLanguageId", "ContentItemLanguageMetadataLatestVersionStatus", Name = "IX_CMS_ContentItemLanguageMetadata_ContentItemID_ContentLanguageID_LatestVersionStatus", - IsUnique = true)] -[Index("ContentItemLanguageMetadataContentWorkflowStepId", Name = "IX_CMS_ContentItemLanguageMetadata_ContentItemLanguageMetadataContentWorkflowStepID")] -[Index("ContentItemLanguageMetadataCreatedByUserId", Name = "IX_CMS_ContentItemLanguageMetadata_ContentItemLanguageMetadataCreatedByUserID")] -[Index("ContentItemLanguageMetadataModifiedByUserId", Name = "IX_CMS_ContentItemLanguageMetadata_ContentItemLanguageMetadataModifiedByUserID")] -public class CmsContentItemLanguageMetadatum -{ - [Key] - [Column("ContentItemLanguageMetadataID")] - public int ContentItemLanguageMetadataId { get; set; } - - [Column("ContentItemLanguageMetadataContentItemID")] - public int ContentItemLanguageMetadataContentItemId { get; set; } - - [StringLength(100)] - public string ContentItemLanguageMetadataDisplayName { get; set; } = null!; - - public int ContentItemLanguageMetadataLatestVersionStatus { get; set; } - - [Column("ContentItemLanguageMetadataGUID")] - public Guid ContentItemLanguageMetadataGuid { get; set; } - - public DateTime ContentItemLanguageMetadataCreatedWhen { get; set; } - - [Column("ContentItemLanguageMetadataCreatedByUserID")] - public int? ContentItemLanguageMetadataCreatedByUserId { get; set; } - - public DateTime ContentItemLanguageMetadataModifiedWhen { get; set; } - - [Column("ContentItemLanguageMetadataModifiedByUserID")] - public int? ContentItemLanguageMetadataModifiedByUserId { get; set; } - - public bool ContentItemLanguageMetadataHasImageAsset { get; set; } - - [Column("ContentItemLanguageMetadataContentLanguageID")] - public int ContentItemLanguageMetadataContentLanguageId { get; set; } - - [Column("ContentItemLanguageMetadataContentWorkflowStepID")] - public int? ContentItemLanguageMetadataContentWorkflowStepId { get; set; } - - public DateTime? ContentItemLanguageMetadataScheduledPublishWhen { get; set; } - - public DateTime? ContentItemLanguageMetadataScheduledUnpublishWhen { get; set; } - - [InverseProperty("ContentItemTagContentItemLanguageMetadata")] - public virtual ICollection CmsContentItemTags { get; set; } = new List(); - - [ForeignKey("ContentItemLanguageMetadataContentItemId")] - [InverseProperty("CmsContentItemLanguageMetadata")] - public virtual CmsContentItem ContentItemLanguageMetadataContentItem { get; set; } = null!; - - [ForeignKey("ContentItemLanguageMetadataContentLanguageId")] - [InverseProperty("CmsContentItemLanguageMetadata")] - public virtual CmsContentLanguage ContentItemLanguageMetadataContentLanguage { get; set; } = null!; - - [ForeignKey("ContentItemLanguageMetadataContentWorkflowStepId")] - [InverseProperty("CmsContentItemLanguageMetadata")] - public virtual CmsContentWorkflowStep? ContentItemLanguageMetadataContentWorkflowStep { get; set; } - - [ForeignKey("ContentItemLanguageMetadataCreatedByUserId")] - [InverseProperty("CmsContentItemLanguageMetadatumContentItemLanguageMetadataCreatedByUsers")] - public virtual CmsUser? ContentItemLanguageMetadataCreatedByUser { get; set; } - - [ForeignKey("ContentItemLanguageMetadataModifiedByUserId")] - [InverseProperty("CmsContentItemLanguageMetadatumContentItemLanguageMetadataModifiedByUsers")] - public virtual CmsUser? ContentItemLanguageMetadataModifiedByUser { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsContentItemReference.cs b/Migration.Tool.KXP/Models/CmsContentItemReference.cs deleted file mode 100644 index 6f8b8edc..00000000 --- a/Migration.Tool.KXP/Models/CmsContentItemReference.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentItemReference")] -[Index("ContentItemReferenceSourceCommonDataId", Name = "IX_CMS_ContentItemReference_ContentItemReferenceSourceCommonDataID")] -[Index("ContentItemReferenceSourceCommonDataId", "ContentItemReferenceTargetItemId", "ContentItemReferenceGroupGuid", Name = "IX_CMS_ContentItemReference_ContentItemReferenceSourceCommonDataID_TargetItemID_GroupGUID", IsUnique = true)] -[Index("ContentItemReferenceTargetItemId", Name = "IX_CMS_ContentItemReference_ContentItemReferenceTargetItemID")] -public class CmsContentItemReference -{ - [Key] - [Column("ContentItemReferenceID")] - public int ContentItemReferenceId { get; set; } - - [Column("ContentItemReferenceGUID")] - public Guid ContentItemReferenceGuid { get; set; } - - [Column("ContentItemReferenceSourceCommonDataID")] - public int ContentItemReferenceSourceCommonDataId { get; set; } - - [Column("ContentItemReferenceTargetItemID")] - public int ContentItemReferenceTargetItemId { get; set; } - - [Column("ContentItemReferenceGroupGUID")] - public Guid ContentItemReferenceGroupGuid { get; set; } - - [ForeignKey("ContentItemReferenceSourceCommonDataId")] - [InverseProperty("CmsContentItemReferences")] - public virtual CmsContentItemCommonDatum ContentItemReferenceSourceCommonData { get; set; } = null!; - - [ForeignKey("ContentItemReferenceTargetItemId")] - [InverseProperty("CmsContentItemReferences")] - public virtual CmsContentItem ContentItemReferenceTargetItem { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentItemTag.cs b/Migration.Tool.KXP/Models/CmsContentItemTag.cs deleted file mode 100644 index cf7afd3a..00000000 --- a/Migration.Tool.KXP/Models/CmsContentItemTag.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentItemTag")] -[Index("ContentItemTagContentItemLanguageMetadataId", Name = "IX_CMS_ContentItemTag_ContentItemTagContentItemLanguageMetadataID")] -[Index("ContentItemTagFieldGuid", Name = "IX_CMS_ContentItemTag_ContentItemTagFieldGUID")] -[Index("ContentItemTagTagGuid", Name = "IX_CMS_ContentItemTag_ContentItemTagTagGUID")] -[Index("ContentItemTagTagGuid", "ContentItemTagFieldGuid", "ContentItemTagContentItemLanguageMetadataId", Name = "IX_CMS_ContentItemTag_ContentItemTagTagGUID_ContentItemTagFieldGUID_ContentItemTagContentItemLanguageMetadataID", IsUnique = true)] -public class CmsContentItemTag -{ - [Key] - [Column("ContentItemTagID")] - public int ContentItemTagId { get; set; } - - [Column("ContentItemTagContentItemLanguageMetadataID")] - public int ContentItemTagContentItemLanguageMetadataId { get; set; } - - [Column("ContentItemTagFieldGUID")] - public Guid ContentItemTagFieldGuid { get; set; } - - [Column("ContentItemTagTagGUID")] - public Guid ContentItemTagTagGuid { get; set; } - - [ForeignKey("ContentItemTagContentItemLanguageMetadataId")] - [InverseProperty("CmsContentItemTags")] - public virtual CmsContentItemLanguageMetadatum ContentItemTagContentItemLanguageMetadata { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentLanguage.cs b/Migration.Tool.KXP/Models/CmsContentLanguage.cs deleted file mode 100644 index 4a41c11a..00000000 --- a/Migration.Tool.KXP/Models/CmsContentLanguage.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentLanguage")] -public class CmsContentLanguage -{ - [Key] - [Column("ContentLanguageID")] - public int ContentLanguageId { get; set; } - - [StringLength(200)] - public string ContentLanguageDisplayName { get; set; } = null!; - - [StringLength(200)] - public string ContentLanguageName { get; set; } = null!; - - public bool ContentLanguageIsDefault { get; set; } - - [Column("ContentLanguageFallbackContentLanguageID")] - public int? ContentLanguageFallbackContentLanguageId { get; set; } - - [StringLength(200)] - public string ContentLanguageCultureFormat { get; set; } = null!; - - [Column("ContentLanguageGUID")] - public Guid ContentLanguageGuid { get; set; } - - [InverseProperty("ContentItemCommonDataContentLanguage")] - public virtual ICollection CmsContentItemCommonData { get; set; } = new List(); - - [InverseProperty("ContentItemLanguageMetadataContentLanguage")] - public virtual ICollection CmsContentItemLanguageMetadata { get; set; } = new List(); - - [InverseProperty("HeadlessChannelPrimaryContentLanguage")] - public virtual ICollection CmsHeadlessChannels { get; set; } = new List(); - - [InverseProperty("WebPageFormerUrlPathContentLanguage")] - public virtual ICollection CmsWebPageFormerUrlPaths { get; set; } = new List(); - - [InverseProperty("WebPageUrlPathContentLanguage")] - public virtual ICollection CmsWebPageUrlPaths { get; set; } = new List(); - - [InverseProperty("WebsiteChannelPrimaryContentLanguage")] - public virtual ICollection CmsWebsiteChannels { get; set; } = new List(); - - [InverseProperty("ActivityLanguage")] - public virtual ICollection OmActivities { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsContentTypeChannel.cs b/Migration.Tool.KXP/Models/CmsContentTypeChannel.cs deleted file mode 100644 index 9999fe71..00000000 --- a/Migration.Tool.KXP/Models/CmsContentTypeChannel.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentTypeChannel")] -[Index("ContentTypeChannelChannelId", "ContentTypeChannelContentTypeId", Name = "IX_CMS_ContentTypeChannel_ContentTypeChannelChannelID_ContentTypeChannelContentTypeID", IsUnique = true)] -[Index("ContentTypeChannelContentTypeId", Name = "IX_CMS_ContentTypeChannel_ContentTypeChannelContentTypeID")] -public class CmsContentTypeChannel -{ - [Key] - [Column("ContentTypeChannelID")] - public int ContentTypeChannelId { get; set; } - - [Column("ContentTypeChannelChannelID")] - public int ContentTypeChannelChannelId { get; set; } - - [Column("ContentTypeChannelContentTypeID")] - public int ContentTypeChannelContentTypeId { get; set; } - - [ForeignKey("ContentTypeChannelChannelId")] - [InverseProperty("CmsContentTypeChannels")] - public virtual CmsChannel ContentTypeChannelChannel { get; set; } = null!; - - [ForeignKey("ContentTypeChannelContentTypeId")] - [InverseProperty("CmsContentTypeChannels")] - public virtual CmsClass ContentTypeChannelContentType { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentWorkflow.cs b/Migration.Tool.KXP/Models/CmsContentWorkflow.cs deleted file mode 100644 index 5a5af769..00000000 --- a/Migration.Tool.KXP/Models/CmsContentWorkflow.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentWorkflow")] -public class CmsContentWorkflow -{ - [Key] - [Column("ContentWorkflowID")] - public int ContentWorkflowId { get; set; } - - [StringLength(200)] - public string ContentWorkflowName { get; set; } = null!; - - [StringLength(200)] - public string ContentWorkflowDisplayName { get; set; } = null!; - - [Column("ContentWorkflowGUID")] - public Guid ContentWorkflowGuid { get; set; } - - public DateTime ContentWorkflowLastModified { get; set; } - - [InverseProperty("ContentWorkflowContentTypeContentWorkflow")] - public virtual ICollection CmsContentWorkflowContentTypes { get; set; } = new List(); - - [InverseProperty("ContentWorkflowStepWorkflow")] - public virtual ICollection CmsContentWorkflowSteps { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsContentWorkflowContentType.cs b/Migration.Tool.KXP/Models/CmsContentWorkflowContentType.cs deleted file mode 100644 index ffa97dff..00000000 --- a/Migration.Tool.KXP/Models/CmsContentWorkflowContentType.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentWorkflowContentType")] -[Index("ContentWorkflowContentTypeContentTypeId", Name = "IX_CMS_ContentWorkflowContentType_ContentWorkflowContentTypeContentTypeID")] -[Index("ContentWorkflowContentTypeContentWorkflowId", Name = "IX_CMS_ContentWorkflowContentType_ContentWorkflowContentTypeContentWorkflowID")] -public class CmsContentWorkflowContentType -{ - [Key] - [Column("ContentWorkflowContentTypeID")] - public int ContentWorkflowContentTypeId { get; set; } - - [Column("ContentWorkflowContentTypeContentWorkflowID")] - public int ContentWorkflowContentTypeContentWorkflowId { get; set; } - - [Column("ContentWorkflowContentTypeContentTypeID")] - public int ContentWorkflowContentTypeContentTypeId { get; set; } - - [ForeignKey("ContentWorkflowContentTypeContentTypeId")] - [InverseProperty("CmsContentWorkflowContentTypes")] - public virtual CmsClass ContentWorkflowContentTypeContentType { get; set; } = null!; - - [ForeignKey("ContentWorkflowContentTypeContentWorkflowId")] - [InverseProperty("CmsContentWorkflowContentTypes")] - public virtual CmsContentWorkflow ContentWorkflowContentTypeContentWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentWorkflowStep.cs b/Migration.Tool.KXP/Models/CmsContentWorkflowStep.cs deleted file mode 100644 index 596d5cba..00000000 --- a/Migration.Tool.KXP/Models/CmsContentWorkflowStep.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentWorkflowStep")] -[Index("ContentWorkflowStepName", Name = "IX_CMS_ContentWorkflowStep_ContentWorkflowStepName", IsUnique = true)] -[Index("ContentWorkflowStepWorkflowId", Name = "IX_CMS_ContentWorkflowStep_ContentWorkflowStepWorkflowID")] -public class CmsContentWorkflowStep -{ - [Key] - [Column("ContentWorkflowStepID")] - public int ContentWorkflowStepId { get; set; } - - [Column("ContentWorkflowStepGUID")] - public Guid ContentWorkflowStepGuid { get; set; } - - [Column("ContentWorkflowStepWorkflowID")] - public int ContentWorkflowStepWorkflowId { get; set; } - - public DateTime ContentWorkflowStepLastModified { get; set; } - - [StringLength(200)] - public string ContentWorkflowStepName { get; set; } = null!; - - [StringLength(200)] - public string ContentWorkflowStepDisplayName { get; set; } = null!; - - [StringLength(200)] - public string ContentWorkflowStepIconClass { get; set; } = null!; - - public int ContentWorkflowStepOrder { get; set; } - - public int ContentWorkflowStepType { get; set; } - - [InverseProperty("ContentItemLanguageMetadataContentWorkflowStep")] - public virtual ICollection CmsContentItemLanguageMetadata { get; set; } = new List(); - - [InverseProperty("ContentWorkflowStepRoleContentWorkflowStep")] - public virtual ICollection CmsContentWorkflowStepRoles { get; set; } = new List(); - - [ForeignKey("ContentWorkflowStepWorkflowId")] - [InverseProperty("CmsContentWorkflowSteps")] - public virtual CmsContentWorkflow ContentWorkflowStepWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsContentWorkflowStepRole.cs b/Migration.Tool.KXP/Models/CmsContentWorkflowStepRole.cs deleted file mode 100644 index dc94904c..00000000 --- a/Migration.Tool.KXP/Models/CmsContentWorkflowStepRole.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ContentWorkflowStepRole")] -[Index("ContentWorkflowStepRoleContentWorkflowStepId", Name = "IX_CMS_ContentWorkflowStepRole_ContentWorkflowStepRoleContentWorkflowStepID")] -[Index("ContentWorkflowStepRoleRoleId", Name = "IX_CMS_ContentWorkflowStepRole_ContentWorkflowStepRoleRoleID")] -public class CmsContentWorkflowStepRole -{ - [Key] - [Column("ContentWorkflowStepRoleID")] - public int ContentWorkflowStepRoleId { get; set; } - - [Column("ContentWorkflowStepRoleContentWorkflowStepID")] - public int ContentWorkflowStepRoleContentWorkflowStepId { get; set; } - - [Column("ContentWorkflowStepRoleRoleID")] - public int ContentWorkflowStepRoleRoleId { get; set; } - - [ForeignKey("ContentWorkflowStepRoleContentWorkflowStepId")] - [InverseProperty("CmsContentWorkflowStepRoles")] - public virtual CmsContentWorkflowStep ContentWorkflowStepRoleContentWorkflowStep { get; set; } = null!; - - [ForeignKey("ContentWorkflowStepRoleRoleId")] - [InverseProperty("CmsContentWorkflowStepRoles")] - public virtual CmsRole ContentWorkflowStepRoleRole { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsCountry.cs b/Migration.Tool.KXP/Models/CmsCountry.cs deleted file mode 100644 index 9559195d..00000000 --- a/Migration.Tool.KXP/Models/CmsCountry.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Country")] -public class CmsCountry -{ - [Key] - [Column("CountryID")] - public int CountryId { get; set; } - - [StringLength(200)] - public string CountryDisplayName { get; set; } = null!; - - [StringLength(200)] - public string CountryName { get; set; } = null!; - - [Column("CountryGUID")] - public Guid CountryGuid { get; set; } - - public DateTime CountryLastModified { get; set; } - - [StringLength(2)] - public string? CountryTwoLetterCode { get; set; } - - [StringLength(3)] - public string? CountryThreeLetterCode { get; set; } - - [InverseProperty("Country")] - public virtual ICollection CmsStates { get; set; } = new List(); - - [InverseProperty("AccountCountry")] - public virtual ICollection OmAccounts { get; set; } = new List(); - - [InverseProperty("ContactCountry")] - public virtual ICollection OmContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsCulture.cs b/Migration.Tool.KXP/Models/CmsCulture.cs deleted file mode 100644 index 6e2bdfa1..00000000 --- a/Migration.Tool.KXP/Models/CmsCulture.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Culture")] -[Index("CultureAlias", Name = "IX_CMS_CulturAlias")] -[Index("CultureCode", Name = "IX_CMS_Culture_CultureCode")] -public class CmsCulture -{ - [Key] - [Column("CultureID")] - public int CultureId { get; set; } - - [StringLength(200)] - public string CultureName { get; set; } = null!; - - [StringLength(50)] - public string CultureCode { get; set; } = null!; - - [StringLength(200)] - public string CultureShortName { get; set; } = null!; - - [Column("CultureGUID")] - public Guid CultureGuid { get; set; } - - public DateTime CultureLastModified { get; set; } - - [StringLength(100)] - public string? CultureAlias { get; set; } - - [Column("CultureIsUICulture")] - public bool? CultureIsUiculture { get; set; } - - [InverseProperty("TranslationCulture")] - public virtual ICollection CmsResourceTranslations { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsEmail.cs b/Migration.Tool.KXP/Models/CmsEmail.cs deleted file mode 100644 index b2c2c406..00000000 --- a/Migration.Tool.KXP/Models/CmsEmail.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Email")] -[Index("EmailEmailConfigurationId", Name = "IX_CMS_Email_EmailEmailConfigurationID")] -[Index("EmailPriority", "EmailId", Name = "IX_CMS_Email_EmailPriority_EmailID", IsUnique = true, IsDescending = new[] { true, false })] -public class CmsEmail -{ - [Key] - [Column("EmailID")] - public int EmailId { get; set; } - - [StringLength(254)] - public string EmailFrom { get; set; } = null!; - - [StringLength(998)] - public string? EmailTo { get; set; } - - [StringLength(998)] - public string? EmailCc { get; set; } - - [StringLength(998)] - public string? EmailBcc { get; set; } - - [StringLength(450)] - public string EmailSubject { get; set; } = null!; - - public string? EmailBody { get; set; } - - public string? EmailPlainTextBody { get; set; } - - public int EmailFormat { get; set; } - - public int EmailPriority { get; set; } - - public string? EmailLastSendResult { get; set; } - - public DateTime? EmailLastSendAttempt { get; set; } - - [Column("EmailGUID")] - public Guid EmailGuid { get; set; } - - public int? EmailStatus { get; set; } - - [StringLength(254)] - public string? EmailReplyTo { get; set; } - - public string? EmailHeaders { get; set; } - - public DateTime? EmailCreated { get; set; } - - [Column("EmailEmailConfigurationID")] - public int? EmailEmailConfigurationId { get; set; } - - public Guid? EmailMailoutGuid { get; set; } - - [ForeignKey("EmailEmailConfigurationId")] - [InverseProperty("CmsEmails")] - public virtual EmailLibraryEmailConfiguration? EmailEmailConfiguration { get; set; } - - [ForeignKey("EmailId")] - [InverseProperty("Emails")] - public virtual ICollection Attachments { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsEmailAttachment.cs b/Migration.Tool.KXP/Models/CmsEmailAttachment.cs deleted file mode 100644 index 4cae81bf..00000000 --- a/Migration.Tool.KXP/Models/CmsEmailAttachment.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_EmailAttachment")] -public class CmsEmailAttachment -{ - [Key] - [Column("AttachmentID")] - public int AttachmentId { get; set; } - - [StringLength(255)] - public string AttachmentName { get; set; } = null!; - - [StringLength(50)] - public string AttachmentExtension { get; set; } = null!; - - public int AttachmentSize { get; set; } - - [StringLength(100)] - public string AttachmentMimeType { get; set; } = null!; - - public byte[] AttachmentBinary { get; set; } = null!; - - [Column("AttachmentGUID")] - public Guid AttachmentGuid { get; set; } - - public DateTime AttachmentLastModified { get; set; } - - [Column("AttachmentContentID")] - [StringLength(255)] - public string? AttachmentContentId { get; set; } - - [ForeignKey("AttachmentId")] - [InverseProperty("Attachments")] - public virtual ICollection Emails { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsEventLog.cs b/Migration.Tool.KXP/Models/CmsEventLog.cs deleted file mode 100644 index 68e8f7ed..00000000 --- a/Migration.Tool.KXP/Models/CmsEventLog.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_EventLog")] -public class CmsEventLog -{ - [Key] - [Column("EventID")] - public int EventId { get; set; } - - [StringLength(5)] - public string EventType { get; set; } = null!; - - public DateTime EventTime { get; set; } - - [StringLength(100)] - public string Source { get; set; } = null!; - - [StringLength(100)] - public string EventCode { get; set; } = null!; - - [Column("UserID")] - public int? UserId { get; set; } - - [StringLength(250)] - public string? UserName { get; set; } - - [Column("IPAddress")] - [StringLength(100)] - public string? Ipaddress { get; set; } - - public string? EventDescription { get; set; } - - public string? EventUrl { get; set; } - - [StringLength(100)] - public string? EventMachineName { get; set; } - - public string? EventUserAgent { get; set; } - - public string? EventUrlReferrer { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsExternalLogin.cs b/Migration.Tool.KXP/Models/CmsExternalLogin.cs deleted file mode 100644 index 437c83fa..00000000 --- a/Migration.Tool.KXP/Models/CmsExternalLogin.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ExternalLogin")] -[Index("UserId", Name = "IX_CMS_ExternalLogin_UserID")] -public class CmsExternalLogin -{ - [Key] - [Column("ExternalLoginID")] - public int ExternalLoginId { get; set; } - - [Column("UserID")] - public int UserId { get; set; } - - [StringLength(100)] - public string LoginProvider { get; set; } = null!; - - [StringLength(100)] - public string IdentityKey { get; set; } = null!; - - [ForeignKey("UserId")] - [InverseProperty("CmsExternalLogins")] - public virtual CmsUser User { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsForm.cs b/Migration.Tool.KXP/Models/CmsForm.cs deleted file mode 100644 index 4285dfd9..00000000 --- a/Migration.Tool.KXP/Models/CmsForm.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Form")] -[Index("FormClassId", Name = "IX_CMS_Form_FormClassID")] -public class CmsForm -{ - [Key] - [Column("FormID")] - public int FormId { get; set; } - - [StringLength(100)] - public string FormDisplayName { get; set; } = null!; - - [StringLength(100)] - public string FormName { get; set; } = null!; - - [Column("FormClassID")] - public int FormClassId { get; set; } - - public int FormItems { get; set; } - - public string? FormReportFields { get; set; } - - [StringLength(400)] - public string? FormSubmitButtonText { get; set; } - - public int? FormAccess { get; set; } - - [StringLength(255)] - public string? FormSubmitButtonImage { get; set; } - - [Column("FormGUID")] - public Guid FormGuid { get; set; } - - public DateTime FormLastModified { get; set; } - - public bool FormLogActivity { get; set; } - - public string? FormBuilderLayout { get; set; } - - [ForeignKey("FormClassId")] - [InverseProperty("CmsForms")] - public virtual CmsClass FormClass { get; set; } = null!; - - [ForeignKey("FormId")] - [InverseProperty("Forms")] - public virtual ICollection Roles { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsFormFeaturedField.cs b/Migration.Tool.KXP/Models/CmsFormFeaturedField.cs deleted file mode 100644 index d081cbd5..00000000 --- a/Migration.Tool.KXP/Models/CmsFormFeaturedField.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_FormFeaturedField")] -public class CmsFormFeaturedField -{ - [Key] - [Column("FormFeaturedFieldID")] - public int FormFeaturedFieldId { get; set; } - - public Guid FormFeaturedFieldGuid { get; set; } - - public DateTime FormFeaturedFieldLastModified { get; set; } - - [StringLength(200)] - public string FormFeaturedFieldDisplayName { get; set; } = null!; - - public string FormFeaturedFieldFormDefinition { get; set; } = null!; - - [StringLength(200)] - public string? FormFeaturedFieldMapping { get; set; } - - public int FormFeaturedFieldOrder { get; set; } - - public string? FormFeaturedFieldDescription { get; set; } - - [StringLength(200)] - public string FormFeaturedFieldName { get; set; } = null!; - - [StringLength(200)] - public string FormFeaturedFieldIconClass { get; set; } = null!; - - public bool FormFeaturedFieldEnabled { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsHeadlessChannel.cs b/Migration.Tool.KXP/Models/CmsHeadlessChannel.cs deleted file mode 100644 index 336f68d0..00000000 --- a/Migration.Tool.KXP/Models/CmsHeadlessChannel.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_HeadlessChannel")] -[Index("HeadlessChannelChannelId", Name = "IX_CMS_HeadlessChannel_HeadlessChannelChannelID")] -[Index("HeadlessChannelPrimaryContentLanguageId", Name = "IX_CMS_HeadlessChannel_HeadlessChannelPrimaryContentLanguageID")] -public class CmsHeadlessChannel -{ - [Key] - [Column("HeadlessChannelID")] - public int HeadlessChannelId { get; set; } - - [Column("HeadlessChannelGUID")] - public Guid HeadlessChannelGuid { get; set; } - - [Column("HeadlessChannelChannelID")] - public int HeadlessChannelChannelId { get; set; } - - [Column("HeadlessChannelPrimaryContentLanguageID")] - public int HeadlessChannelPrimaryContentLanguageId { get; set; } - - [Column("HeadlessChannelPreviewURL")] - [StringLength(200)] - public string? HeadlessChannelPreviewUrl { get; set; } - - [InverseProperty("HeadlessItemHeadlessChannel")] - public virtual ICollection CmsHeadlessItems { get; set; } = new List(); - - [InverseProperty("HeadlessTokenHeadlessChannel")] - public virtual ICollection CmsHeadlessTokens { get; set; } = new List(); - - [ForeignKey("HeadlessChannelChannelId")] - [InverseProperty("CmsHeadlessChannels")] - public virtual CmsChannel HeadlessChannelChannel { get; set; } = null!; - - [ForeignKey("HeadlessChannelPrimaryContentLanguageId")] - [InverseProperty("CmsHeadlessChannels")] - public virtual CmsContentLanguage HeadlessChannelPrimaryContentLanguage { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsHeadlessItem.cs b/Migration.Tool.KXP/Models/CmsHeadlessItem.cs deleted file mode 100644 index b3f92838..00000000 --- a/Migration.Tool.KXP/Models/CmsHeadlessItem.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_HeadlessItem")] -[Index("HeadlessItemContentItemId", Name = "IX_CMS_HeadlessItem_HeadlessItemContentItemID")] -[Index("HeadlessItemHeadlessChannelId", Name = "IX_CMS_HeadlessItem_HeadlessItemHeadlessChannelID")] -public class CmsHeadlessItem -{ - [Key] - [Column("HeadlessItemID")] - public int HeadlessItemId { get; set; } - - [Column("HeadlessItemGUID")] - public Guid HeadlessItemGuid { get; set; } - - [Column("HeadlessItemHeadlessChannelID")] - public int HeadlessItemHeadlessChannelId { get; set; } - - [Column("HeadlessItemContentItemID")] - public int HeadlessItemContentItemId { get; set; } - - [StringLength(200)] - public string HeadlessItemName { get; set; } = null!; - - [ForeignKey("HeadlessItemContentItemId")] - [InverseProperty("CmsHeadlessItems")] - public virtual CmsContentItem HeadlessItemContentItem { get; set; } = null!; - - [ForeignKey("HeadlessItemHeadlessChannelId")] - [InverseProperty("CmsHeadlessItems")] - public virtual CmsHeadlessChannel HeadlessItemHeadlessChannel { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsHeadlessToken.cs b/Migration.Tool.KXP/Models/CmsHeadlessToken.cs deleted file mode 100644 index 6c7c5ec1..00000000 --- a/Migration.Tool.KXP/Models/CmsHeadlessToken.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_HeadlessToken")] -[Index("HeadlessTokenCreatedByUserId", Name = "IX_CMS_HeadlessToken_HeadlessTokenCreatedByUserID")] -[Index("HeadlessTokenHash", Name = "IX_CMS_HeadlessToken_HeadlessTokenHash")] -[Index("HeadlessTokenHeadlessChannelId", Name = "IX_CMS_HeadlessToken_HeadlessTokenHeadlessChannelID")] -[Index("HeadlessTokenModifiedByUserId", Name = "IX_CMS_HeadlessToken_HeadlessTokenModifiedByUserID")] -public class CmsHeadlessToken -{ - [Key] - [Column("HeadlessTokenID")] - public int HeadlessTokenId { get; set; } - - [Column("HeadlessTokenGUID")] - public Guid HeadlessTokenGuid { get; set; } - - [Column("HeadlessTokenHeadlessChannelID")] - public int HeadlessTokenHeadlessChannelId { get; set; } - - [StringLength(200)] - public string HeadlessTokenDisplayName { get; set; } = null!; - - public bool HeadlessTokenEnabled { get; set; } - - public DateTime HeadlessTokenCreatedWhen { get; set; } - - [Column("HeadlessTokenCreatedByUserID")] - public int? HeadlessTokenCreatedByUserId { get; set; } - - public DateTime HeadlessTokenModifiedWhen { get; set; } - - [Column("HeadlessTokenModifiedByUserID")] - public int? HeadlessTokenModifiedByUserId { get; set; } - - [StringLength(64)] - public string HeadlessTokenHash { get; set; } = null!; - - [StringLength(200)] - public string HeadlessTokenAccessType { get; set; } = null!; - - [ForeignKey("HeadlessTokenCreatedByUserId")] - [InverseProperty("CmsHeadlessTokenHeadlessTokenCreatedByUsers")] - public virtual CmsUser? HeadlessTokenCreatedByUser { get; set; } - - [ForeignKey("HeadlessTokenHeadlessChannelId")] - [InverseProperty("CmsHeadlessTokens")] - public virtual CmsHeadlessChannel HeadlessTokenHeadlessChannel { get; set; } = null!; - - [ForeignKey("HeadlessTokenModifiedByUserId")] - [InverseProperty("CmsHeadlessTokenHeadlessTokenModifiedByUsers")] - public virtual CmsUser? HeadlessTokenModifiedByUser { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsLicenseKey.cs b/Migration.Tool.KXP/Models/CmsLicenseKey.cs deleted file mode 100644 index 91e5afc1..00000000 --- a/Migration.Tool.KXP/Models/CmsLicenseKey.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_LicenseKey")] -public class CmsLicenseKey -{ - [Key] - [Column("LicenseKeyID")] - public int LicenseKeyId { get; set; } - - [StringLength(255)] - public string? LicenseDomain { get; set; } - - public string? LicenseKey { get; set; } - - [StringLength(200)] - public string? LicenseEdition { get; set; } - - [StringLength(200)] - public string? LicenseExpiration { get; set; } - - public int? LicenseServers { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsMacroIdentity.cs b/Migration.Tool.KXP/Models/CmsMacroIdentity.cs deleted file mode 100644 index d2fe9b99..00000000 --- a/Migration.Tool.KXP/Models/CmsMacroIdentity.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_MacroIdentity")] -[Index("MacroIdentityEffectiveUserId", Name = "IX_CMS_MacroIdentity_MacroIdentityEffectiveUserID")] -public class CmsMacroIdentity -{ - [Key] - [Column("MacroIdentityID")] - public int MacroIdentityId { get; set; } - - public Guid MacroIdentityGuid { get; set; } - - public DateTime MacroIdentityLastModified { get; set; } - - [StringLength(200)] - public string MacroIdentityName { get; set; } = null!; - - [Column("MacroIdentityEffectiveUserID")] - public int? MacroIdentityEffectiveUserId { get; set; } - - [InverseProperty("UserMacroIdentityMacroIdentity")] - public virtual ICollection CmsUserMacroIdentities { get; set; } = new List(); - - [ForeignKey("MacroIdentityEffectiveUserId")] - [InverseProperty("CmsMacroIdentities")] - public virtual CmsUser? MacroIdentityEffectiveUser { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsMacroRule.cs b/Migration.Tool.KXP/Models/CmsMacroRule.cs deleted file mode 100644 index 70171340..00000000 --- a/Migration.Tool.KXP/Models/CmsMacroRule.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_MacroRule")] -public class CmsMacroRule -{ - [Key] - [Column("MacroRuleID")] - public int MacroRuleId { get; set; } - - [StringLength(200)] - public string MacroRuleName { get; set; } = null!; - - [StringLength(1000)] - public string MacroRuleText { get; set; } = null!; - - public string? MacroRuleParameters { get; set; } - - public DateTime MacroRuleLastModified { get; set; } - - [Column("MacroRuleGUID")] - public Guid MacroRuleGuid { get; set; } - - public string MacroRuleCondition { get; set; } = null!; - - [StringLength(500)] - public string MacroRuleDisplayName { get; set; } = null!; - - public bool? MacroRuleIsCustom { get; set; } - - [StringLength(450)] - public string? MacroRuleDescription { get; set; } - - public bool? MacroRuleEnabled { get; set; } - - [InverseProperty("MacroRule")] - public virtual ICollection CmsMacroRuleMacroRuleCategories { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsMacroRuleCategory.cs b/Migration.Tool.KXP/Models/CmsMacroRuleCategory.cs deleted file mode 100644 index 961711cc..00000000 --- a/Migration.Tool.KXP/Models/CmsMacroRuleCategory.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_MacroRuleCategory")] -public class CmsMacroRuleCategory -{ - [Key] - [Column("MacroRuleCategoryID")] - public int MacroRuleCategoryId { get; set; } - - public Guid MacroRuleCategoryGuid { get; set; } - - public DateTime MacroRuleCategoryLastModified { get; set; } - - [StringLength(200)] - public string MacroRuleCategoryName { get; set; } = null!; - - [StringLength(200)] - public string MacroRuleCategoryDisplayName { get; set; } = null!; - - [StringLength(450)] - public string? MacroRuleCategoryDescription { get; set; } - - public bool MacroRuleCategoryEnabled { get; set; } - - [InverseProperty("MacroRuleCategory")] - public virtual ICollection CmsMacroRuleMacroRuleCategories { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsMacroRuleMacroRuleCategory.cs b/Migration.Tool.KXP/Models/CmsMacroRuleMacroRuleCategory.cs deleted file mode 100644 index 93e1b35a..00000000 --- a/Migration.Tool.KXP/Models/CmsMacroRuleMacroRuleCategory.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_MacroRuleMacroRuleCategory")] -[Index("MacroRuleCategoryId", Name = "IX_CMS_MacroRuleMacroRuleCategory_MacroRuleCategoryID")] -[Index("MacroRuleId", Name = "IX_CMS_MacroRuleMacroRuleCategory_MacroRuleID")] -public class CmsMacroRuleMacroRuleCategory -{ - [Key] - [Column("MacroRuleMacroRuleCategoryID")] - public int MacroRuleMacroRuleCategoryId { get; set; } - - [Column("MacroRuleID")] - public int MacroRuleId { get; set; } - - [Column("MacroRuleCategoryID")] - public int MacroRuleCategoryId { get; set; } - - [ForeignKey("MacroRuleId")] - [InverseProperty("CmsMacroRuleMacroRuleCategories")] - public virtual CmsMacroRule MacroRule { get; set; } = null!; - - [ForeignKey("MacroRuleCategoryId")] - [InverseProperty("CmsMacroRuleMacroRuleCategories")] - public virtual CmsMacroRuleCategory MacroRuleCategory { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsMember.cs b/Migration.Tool.KXP/Models/CmsMember.cs deleted file mode 100644 index d22e621d..00000000 --- a/Migration.Tool.KXP/Models/CmsMember.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Member")] -public class CmsMember -{ - [Key] - [Column("MemberID")] - public int MemberId { get; set; } - - [StringLength(254)] - public string? MemberEmail { get; set; } - - public bool MemberEnabled { get; set; } - - public DateTime MemberCreated { get; set; } - - public Guid MemberGuid { get; set; } - - [StringLength(254)] - public string? MemberName { get; set; } - - [StringLength(100)] - public string? MemberPassword { get; set; } - - public bool MemberIsExternal { get; set; } - - [StringLength(72)] - public string? MemberSecurityStamp { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsMemberExternalLogin.cs b/Migration.Tool.KXP/Models/CmsMemberExternalLogin.cs deleted file mode 100644 index 8b4915cc..00000000 --- a/Migration.Tool.KXP/Models/CmsMemberExternalLogin.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_MemberExternalLogin")] -[Index("MemberExternalLoginLoginProvider", "MemberExternalLoginIdentityKey", Name = "IX_CMS_MemberExternalLogin_MemberExternalLoginLoginProvider_MemberExternalLoginIdentityKey", IsUnique = true)] -[Index("MemberExternalLoginMemberId", Name = "IX_CMS_MemberExternalLogin_MemberExternalLoginMemberID")] -public class CmsMemberExternalLogin -{ - [Key] - [Column("MemberExternalLoginID")] - public int MemberExternalLoginId { get; set; } - - [Column("MemberExternalLoginMemberID")] - public int MemberExternalLoginMemberId { get; set; } - - [StringLength(100)] - public string MemberExternalLoginLoginProvider { get; set; } = null!; - - [StringLength(100)] - public string MemberExternalLoginIdentityKey { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsObjectWorkflowTrigger.cs b/Migration.Tool.KXP/Models/CmsObjectWorkflowTrigger.cs deleted file mode 100644 index ce3992a5..00000000 --- a/Migration.Tool.KXP/Models/CmsObjectWorkflowTrigger.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ObjectWorkflowTrigger")] -[Index("TriggerWorkflowId", Name = "IX_CMS_ObjectWorkflowTrigger_TriggerWorkflowID")] -public class CmsObjectWorkflowTrigger -{ - [Key] - [Column("TriggerID")] - public int TriggerId { get; set; } - - [Column("TriggerGUID")] - public Guid TriggerGuid { get; set; } - - public DateTime TriggerLastModified { get; set; } - - public int TriggerType { get; set; } - - public string? TriggerMacroCondition { get; set; } - - [Column("TriggerWorkflowID")] - public int TriggerWorkflowId { get; set; } - - [StringLength(450)] - public string TriggerDisplayName { get; set; } = null!; - - [StringLength(100)] - public string TriggerObjectType { get; set; } = null!; - - public string? TriggerParameters { get; set; } - - [StringLength(100)] - public string? TriggerTargetObjectType { get; set; } - - [Column("TriggerTargetObjectID")] - public int? TriggerTargetObjectId { get; set; } - - [ForeignKey("TriggerWorkflowId")] - [InverseProperty("CmsObjectWorkflowTriggers")] - public virtual CmsWorkflow TriggerWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsPageTemplateConfiguration.cs b/Migration.Tool.KXP/Models/CmsPageTemplateConfiguration.cs deleted file mode 100644 index adef3336..00000000 --- a/Migration.Tool.KXP/Models/CmsPageTemplateConfiguration.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_PageTemplateConfiguration")] -public class CmsPageTemplateConfiguration -{ - [Key] - [Column("PageTemplateConfigurationID")] - public int PageTemplateConfigurationId { get; set; } - - [Column("PageTemplateConfigurationGUID")] - public Guid PageTemplateConfigurationGuid { get; set; } - - public DateTime PageTemplateConfigurationLastModified { get; set; } - - [StringLength(200)] - public string PageTemplateConfigurationName { get; set; } = null!; - - public string? PageTemplateConfigurationDescription { get; set; } - - public string PageTemplateConfigurationTemplate { get; set; } = null!; - - public string? PageTemplateConfigurationWidgets { get; set; } - - [StringLength(200)] - public string PageTemplateConfigurationIcon { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsQuery.cs b/Migration.Tool.KXP/Models/CmsQuery.cs deleted file mode 100644 index cd3ceb32..00000000 --- a/Migration.Tool.KXP/Models/CmsQuery.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Query")] -[Index("ClassId", "QueryName", Name = "IX_CMS_Query_QueryClassID_QueryName")] -public class CmsQuery -{ - [Key] - [Column("QueryID")] - public int QueryId { get; set; } - - [StringLength(100)] - public string QueryName { get; set; } = null!; - - [Column("QueryTypeID")] - public int QueryTypeId { get; set; } - - public string QueryText { get; set; } = null!; - - public bool QueryRequiresTransaction { get; set; } - - [Column("ClassID")] - public int? ClassId { get; set; } - - public DateTime QueryLastModified { get; set; } - - [Column("QueryGUID")] - public Guid QueryGuid { get; set; } - - public bool? QueryIsCustom { get; set; } - - [StringLength(100)] - public string? QueryConnectionString { get; set; } - - [ForeignKey("ClassId")] - [InverseProperty("CmsQueries")] - public virtual CmsClass? Class { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsResource.cs b/Migration.Tool.KXP/Models/CmsResource.cs deleted file mode 100644 index 5c4c00fb..00000000 --- a/Migration.Tool.KXP/Models/CmsResource.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Resource")] -[Index("ResourceName", Name = "IX_CMS_Resource_ResourceName")] -public class CmsResource -{ - [Key] - [Column("ResourceID")] - public int ResourceId { get; set; } - - [StringLength(100)] - public string ResourceDisplayName { get; set; } = null!; - - [StringLength(100)] - public string ResourceName { get; set; } = null!; - - public string? ResourceDescription { get; set; } - - [Column("ResourceGUID")] - public Guid ResourceGuid { get; set; } - - public DateTime ResourceLastModified { get; set; } - - public bool? ResourceIsInDevelopment { get; set; } - - [InverseProperty("ClassResource")] - public virtual ICollection CmsClasses { get; set; } = new List(); - - [InverseProperty("CategoryResource")] - public virtual ICollection CmsSettingsCategories { get; set; } = new List(); - - [InverseProperty("ActionResource")] - public virtual ICollection CmsWorkflowActions { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsResourceString.cs b/Migration.Tool.KXP/Models/CmsResourceString.cs deleted file mode 100644 index b68f7c40..00000000 --- a/Migration.Tool.KXP/Models/CmsResourceString.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ResourceString")] -[Index("StringKey", Name = "IX_CMS_ResourceString_StringKey")] -public class CmsResourceString -{ - [Key] - [Column("StringID")] - public int StringId { get; set; } - - [StringLength(200)] - public string StringKey { get; set; } = null!; - - public bool StringIsCustom { get; set; } - - [Column("StringGUID")] - public Guid StringGuid { get; set; } - - [InverseProperty("TranslationString")] - public virtual ICollection CmsResourceTranslations { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsResourceTranslation.cs b/Migration.Tool.KXP/Models/CmsResourceTranslation.cs deleted file mode 100644 index 18b0fff1..00000000 --- a/Migration.Tool.KXP/Models/CmsResourceTranslation.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ResourceTranslation")] -[Index("TranslationCultureId", Name = "IX_CMS_ResourceTranslation_TranslationCultureID")] -[Index("TranslationStringId", Name = "IX_CMS_ResourceTranslation_TranslationStringID")] -public class CmsResourceTranslation -{ - [Key] - [Column("TranslationID")] - public int TranslationId { get; set; } - - [Column("TranslationStringID")] - public int TranslationStringId { get; set; } - - public string? TranslationText { get; set; } - - [Column("TranslationCultureID")] - public int TranslationCultureId { get; set; } - - [ForeignKey("TranslationCultureId")] - [InverseProperty("CmsResourceTranslations")] - public virtual CmsCulture TranslationCulture { get; set; } = null!; - - [ForeignKey("TranslationStringId")] - [InverseProperty("CmsResourceTranslations")] - public virtual CmsResourceString TranslationString { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsRole.cs b/Migration.Tool.KXP/Models/CmsRole.cs deleted file mode 100644 index adff4fdc..00000000 --- a/Migration.Tool.KXP/Models/CmsRole.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Role")] -public class CmsRole -{ - [Key] - [Column("RoleID")] - public int RoleId { get; set; } - - [StringLength(100)] - public string RoleDisplayName { get; set; } = null!; - - [StringLength(100)] - public string RoleName { get; set; } = null!; - - public string? RoleDescription { get; set; } - - [Column("RoleGUID")] - public Guid RoleGuid { get; set; } - - public DateTime RoleLastModified { get; set; } - - [InverseProperty("Role")] - public virtual ICollection CmsApplicationPermissions { get; set; } = new List(); - - [InverseProperty("ContentWorkflowStepRoleRole")] - public virtual ICollection CmsContentWorkflowStepRoles { get; set; } = new List(); - - [InverseProperty("Role")] - public virtual ICollection CmsUserRoles { get; set; } = new List(); - - [ForeignKey("RoleId")] - [InverseProperty("Roles")] - public virtual ICollection Forms { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsScheduledTask.cs b/Migration.Tool.KXP/Models/CmsScheduledTask.cs deleted file mode 100644 index a93ed9bc..00000000 --- a/Migration.Tool.KXP/Models/CmsScheduledTask.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_ScheduledTask")] -[Index("TaskNextRunTime", "TaskEnabled", "TaskServerName", Name = "IX_CMS_ScheduledTask_TaskNextRunTime_TaskEnabled_TaskServerName")] -[Index("TaskUserId", Name = "IX_CMS_ScheduledTask_TaskUserID")] -public class CmsScheduledTask -{ - [Key] - [Column("TaskID")] - public int TaskId { get; set; } - - [StringLength(200)] - public string TaskName { get; set; } = null!; - - [StringLength(200)] - public string TaskDisplayName { get; set; } = null!; - - [StringLength(200)] - public string TaskAssemblyName { get; set; } = null!; - - [StringLength(200)] - public string? TaskClass { get; set; } - - [StringLength(1000)] - public string TaskInterval { get; set; } = null!; - - public string TaskData { get; set; } = null!; - - public DateTime? TaskLastRunTime { get; set; } - - public DateTime? TaskNextRunTime { get; set; } - - public string? TaskLastResult { get; set; } - - public bool? TaskDeleteAfterLastRun { get; set; } - - [StringLength(100)] - public string? TaskServerName { get; set; } - - [Column("TaskGUID")] - public Guid TaskGuid { get; set; } - - public DateTime TaskLastModified { get; set; } - - public int? TaskExecutions { get; set; } - - [Column("TaskUserID")] - public int? TaskUserId { get; set; } - - public int? TaskType { get; set; } - - [StringLength(100)] - public string? TaskObjectType { get; set; } - - [Column("TaskObjectID")] - public int? TaskObjectId { get; set; } - - [StringLength(200)] - public string? TaskExecutingServerName { get; set; } - - public bool TaskEnabled { get; set; } - - public bool TaskIsRunning { get; set; } - - [ForeignKey("TaskUserId")] - [InverseProperty("CmsScheduledTasks")] - public virtual CmsUser? TaskUser { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsSettingsCategory.cs b/Migration.Tool.KXP/Models/CmsSettingsCategory.cs deleted file mode 100644 index b9a096b6..00000000 --- a/Migration.Tool.KXP/Models/CmsSettingsCategory.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_SettingsCategory")] -[Index("CategoryParentId", Name = "IX_CMS_SettingsCategory_CategoryParentID")] -[Index("CategoryResourceId", Name = "IX_CMS_SettingsCategory_CategoryResourceID")] -public class CmsSettingsCategory -{ - [Key] - [Column("CategoryID")] - public int CategoryId { get; set; } - - [StringLength(200)] - public string CategoryDisplayName { get; set; } = null!; - - public int? CategoryOrder { get; set; } - - [StringLength(100)] - public string? CategoryName { get; set; } - - [Column("CategoryParentID")] - public int? CategoryParentId { get; set; } - - [Column("CategoryIDPath")] - [StringLength(450)] - public string? CategoryIdpath { get; set; } - - public int? CategoryLevel { get; set; } - - public int? CategoryChildCount { get; set; } - - [StringLength(200)] - public string? CategoryIconPath { get; set; } - - public bool? CategoryIsGroup { get; set; } - - public bool? CategoryIsCustom { get; set; } - - [Column("CategoryResourceID")] - public int? CategoryResourceId { get; set; } - - [ForeignKey("CategoryParentId")] - [InverseProperty("InverseCategoryParent")] - public virtual CmsSettingsCategory? CategoryParent { get; set; } - - [ForeignKey("CategoryResourceId")] - [InverseProperty("CmsSettingsCategories")] - public virtual CmsResource? CategoryResource { get; set; } - - [InverseProperty("KeyCategory")] - public virtual ICollection CmsSettingsKeys { get; set; } = new List(); - - [InverseProperty("CategoryParent")] - public virtual ICollection InverseCategoryParent { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsSettingsKey.cs b/Migration.Tool.KXP/Models/CmsSettingsKey.cs deleted file mode 100644 index 57e7b30e..00000000 --- a/Migration.Tool.KXP/Models/CmsSettingsKey.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_SettingsKey")] -[Index("KeyCategoryId", Name = "IX_CMS_SettingsKey_KeyCategoryID")] -[Index("KeyName", Name = "IX_CMS_SettingsKey_KeyName")] -public class CmsSettingsKey -{ - [Key] - [Column("KeyID")] - public int KeyId { get; set; } - - [StringLength(100)] - public string KeyName { get; set; } = null!; - - [StringLength(200)] - public string KeyDisplayName { get; set; } = null!; - - public string? KeyDescription { get; set; } - - public string? KeyValue { get; set; } - - [StringLength(50)] - public string KeyType { get; set; } = null!; - - [Column("KeyCategoryID")] - public int? KeyCategoryId { get; set; } - - [Column("KeyGUID")] - public Guid KeyGuid { get; set; } - - public DateTime KeyLastModified { get; set; } - - public int? KeyOrder { get; set; } - - [StringLength(255)] - public string? KeyValidation { get; set; } - - [StringLength(200)] - public string? KeyEditingControlPath { get; set; } - - public bool? KeyIsCustom { get; set; } - - public bool? KeyIsHidden { get; set; } - - public string? KeyFormControlSettings { get; set; } - - public string? KeyExplanationText { get; set; } - - [ForeignKey("KeyCategoryId")] - [InverseProperty("CmsSettingsKeys")] - public virtual CmsSettingsCategory? KeyCategory { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsSmartFolder.cs b/Migration.Tool.KXP/Models/CmsSmartFolder.cs deleted file mode 100644 index 91a373a1..00000000 --- a/Migration.Tool.KXP/Models/CmsSmartFolder.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_SmartFolder")] -[Index("SmartFolderCreatedByUserId", Name = "IX_CMS_SmartFolder_SmartFolderCreatedByUserID")] -[Index("SmartFolderGuid", Name = "IX_CMS_SmartFolder_SmartFolderGUID_Unique", IsUnique = true)] -[Index("SmartFolderModifiedByUserId", Name = "IX_CMS_SmartFolder_SmartFolderModifiedByUserID")] -public class CmsSmartFolder -{ - [Key] - [Column("SmartFolderID")] - public int SmartFolderId { get; set; } - - [Column("SmartFolderGUID")] - public Guid SmartFolderGuid { get; set; } - - [StringLength(50)] - public string SmartFolderName { get; set; } = null!; - - [StringLength(50)] - public string SmartFolderDisplayName { get; set; } = null!; - - public DateTime SmartFolderCreatedWhen { get; set; } - - [Column("SmartFolderCreatedByUserID")] - public int? SmartFolderCreatedByUserId { get; set; } - - public DateTime? SmartFolderModifiedWhen { get; set; } - - [Column("SmartFolderModifiedByUserID")] - public int? SmartFolderModifiedByUserId { get; set; } - - public string SmartFolderFilter { get; set; } = null!; - - [ForeignKey("SmartFolderCreatedByUserId")] - [InverseProperty("CmsSmartFolderSmartFolderCreatedByUsers")] - public virtual CmsUser? SmartFolderCreatedByUser { get; set; } - - [ForeignKey("SmartFolderModifiedByUserId")] - [InverseProperty("CmsSmartFolderSmartFolderModifiedByUsers")] - public virtual CmsUser? SmartFolderModifiedByUser { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsState.cs b/Migration.Tool.KXP/Models/CmsState.cs deleted file mode 100644 index 6034db5c..00000000 --- a/Migration.Tool.KXP/Models/CmsState.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_State")] -[Index("CountryId", Name = "IX_CMS_State_CountryID")] -[Index("StateCode", Name = "IX_CMS_State_StateCode")] -public class CmsState -{ - [Key] - [Column("StateID")] - public int StateId { get; set; } - - [StringLength(200)] - public string StateDisplayName { get; set; } = null!; - - [StringLength(200)] - public string StateName { get; set; } = null!; - - [StringLength(100)] - public string? StateCode { get; set; } - - [Column("CountryID")] - public int CountryId { get; set; } - - [Column("StateGUID")] - public Guid StateGuid { get; set; } - - public DateTime StateLastModified { get; set; } - - [ForeignKey("CountryId")] - [InverseProperty("CmsStates")] - public virtual CmsCountry Country { get; set; } = null!; - - [InverseProperty("AccountState")] - public virtual ICollection OmAccounts { get; set; } = new List(); - - [InverseProperty("ContactState")] - public virtual ICollection OmContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsTag.cs b/Migration.Tool.KXP/Models/CmsTag.cs deleted file mode 100644 index c56da97d..00000000 --- a/Migration.Tool.KXP/Models/CmsTag.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Tag")] -[Index("TagParentId", Name = "IX_CMS_Tag_TagParentID")] -[Index("TagTaxonomyId", Name = "IX_CMS_Tag_TagTaxonomyID")] -public class CmsTag -{ - [Key] - [Column("TagID")] - public int TagId { get; set; } - - [StringLength(200)] - public string TagName { get; set; } = null!; - - [Column("TagGUID")] - public Guid TagGuid { get; set; } - - [Column("TagTaxonomyID")] - public int TagTaxonomyId { get; set; } - - [Column("TagParentID")] - public int? TagParentId { get; set; } - - public int? TagOrder { get; set; } - - public string? TagMetadata { get; set; } - - public DateTime TagLastModified { get; set; } - - [StringLength(200)] - public string TagTitle { get; set; } = null!; - - public string? TagDescription { get; set; } - - [InverseProperty("TagParent")] - public virtual ICollection InverseTagParent { get; set; } = new List(); - - [ForeignKey("TagParentId")] - [InverseProperty("InverseTagParent")] - public virtual CmsTag? TagParent { get; set; } - - [ForeignKey("TagTaxonomyId")] - [InverseProperty("CmsTags")] - public virtual CmsTaxonomy TagTaxonomy { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsTaxonomy.cs b/Migration.Tool.KXP/Models/CmsTaxonomy.cs deleted file mode 100644 index ed4cae99..00000000 --- a/Migration.Tool.KXP/Models/CmsTaxonomy.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Taxonomy")] -public class CmsTaxonomy -{ - [Key] - [Column("TaxonomyID")] - public int TaxonomyId { get; set; } - - [StringLength(200)] - public string TaxonomyName { get; set; } = null!; - - [Column("TaxonomyGUID")] - public Guid TaxonomyGuid { get; set; } - - public string? TaxonomyMetadata { get; set; } - - public DateTime TaxonomyLastModified { get; set; } - - [StringLength(200)] - public string TaxonomyTitle { get; set; } = null!; - - public string? TaxonomyDescription { get; set; } - - [InverseProperty("TagTaxonomy")] - public virtual ICollection CmsTags { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsUser.cs b/Migration.Tool.KXP/Models/CmsUser.cs deleted file mode 100644 index 288cc5e5..00000000 --- a/Migration.Tool.KXP/Models/CmsUser.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_User")] -[Index("UserGuid", Name = "IX_CMS_User_UserGUID", IsUnique = true)] -[Index("UserName", Name = "IX_CMS_User_UserName", IsUnique = true)] -public class CmsUser -{ - [Key] - [Column("UserID")] - public int UserId { get; set; } - - [StringLength(254)] - public string UserName { get; set; } = null!; - - [StringLength(100)] - public string? FirstName { get; set; } - - [StringLength(100)] - public string? LastName { get; set; } - - [StringLength(254)] - public string? Email { get; set; } - - [StringLength(100)] - public string UserPassword { get; set; } = null!; - - public bool UserEnabled { get; set; } - - public DateTime? UserCreated { get; set; } - - public DateTime? LastLogon { get; set; } - - [Column("UserGUID")] - public Guid UserGuid { get; set; } - - public DateTime UserLastModified { get; set; } - - [StringLength(72)] - public string? UserSecurityStamp { get; set; } - - public DateTime? UserPasswordLastChanged { get; set; } - - public bool UserIsPendingRegistration { get; set; } - - public DateTime? UserRegistrationLinkExpiration { get; set; } - - public bool UserAdministrationAccess { get; set; } - - public bool UserIsExternal { get; set; } - - [InverseProperty("HistoryApprovedByUser")] - public virtual ICollection CmsAutomationHistories { get; set; } = new List(); - - [InverseProperty("StateUser")] - public virtual ICollection CmsAutomationStates { get; set; } = new List(); - - [InverseProperty("ContentFolderCreatedByUser")] - public virtual ICollection CmsContentFolderContentFolderCreatedByUsers { get; set; } = new List(); - - [InverseProperty("ContentFolderModifiedByUser")] - public virtual ICollection CmsContentFolderContentFolderModifiedByUsers { get; set; } = new List(); - - [InverseProperty("ContentItemLanguageMetadataCreatedByUser")] - public virtual ICollection CmsContentItemLanguageMetadatumContentItemLanguageMetadataCreatedByUsers { get; set; } = new List(); - - [InverseProperty("ContentItemLanguageMetadataModifiedByUser")] - public virtual ICollection CmsContentItemLanguageMetadatumContentItemLanguageMetadataModifiedByUsers { get; set; } = new List(); - - [InverseProperty("User")] - public virtual ICollection CmsExternalLogins { get; set; } = new List(); - - [InverseProperty("HeadlessTokenCreatedByUser")] - public virtual ICollection CmsHeadlessTokenHeadlessTokenCreatedByUsers { get; set; } = new List(); - - [InverseProperty("HeadlessTokenModifiedByUser")] - public virtual ICollection CmsHeadlessTokenHeadlessTokenModifiedByUsers { get; set; } = new List(); - - [InverseProperty("MacroIdentityEffectiveUser")] - public virtual ICollection CmsMacroIdentities { get; set; } = new List(); - - [InverseProperty("TaskUser")] - public virtual ICollection CmsScheduledTasks { get; set; } = new List(); - - [InverseProperty("SmartFolderCreatedByUser")] - public virtual ICollection CmsSmartFolderSmartFolderCreatedByUsers { get; set; } = new List(); - - [InverseProperty("SmartFolderModifiedByUser")] - public virtual ICollection CmsSmartFolderSmartFolderModifiedByUsers { get; set; } = new List(); - - [InverseProperty("UserMacroIdentityUser")] - public virtual CmsUserMacroIdentity? CmsUserMacroIdentity { get; set; } - - [InverseProperty("User")] - public virtual ICollection CmsUserRoles { get; set; } = new List(); - - [InverseProperty("FileCreatedByUser")] - public virtual ICollection MediaFileFileCreatedByUsers { get; set; } = new List(); - - [InverseProperty("FileModifiedByUser")] - public virtual ICollection MediaFileFileModifiedByUsers { get; set; } = new List(); - - [InverseProperty("AccountOwnerUser")] - public virtual ICollection OmAccounts { get; set; } = new List(); - - [InverseProperty("ContactOwnerUser")] - public virtual ICollection OmContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsUserMacroIdentity.cs b/Migration.Tool.KXP/Models/CmsUserMacroIdentity.cs deleted file mode 100644 index 35ecb250..00000000 --- a/Migration.Tool.KXP/Models/CmsUserMacroIdentity.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_UserMacroIdentity")] -[Index("UserMacroIdentityMacroIdentityId", Name = "IX_CMS_UserMacroIdentity_UserMacroIdentityMacroIdentityID")] -[Index("UserMacroIdentityUserId", Name = "UQ_CMS_UserMacroIdentity_UserMacroIdentityUserID", IsUnique = true)] -public class CmsUserMacroIdentity -{ - [Key] - [Column("UserMacroIdentityID")] - public int UserMacroIdentityId { get; set; } - - public DateTime UserMacroIdentityLastModified { get; set; } - - [Column("UserMacroIdentityUserID")] - public int UserMacroIdentityUserId { get; set; } - - [Column("UserMacroIdentityMacroIdentityID")] - public int? UserMacroIdentityMacroIdentityId { get; set; } - - public Guid UserMacroIdentityUserGuid { get; set; } - - [ForeignKey("UserMacroIdentityMacroIdentityId")] - [InverseProperty("CmsUserMacroIdentities")] - public virtual CmsMacroIdentity? UserMacroIdentityMacroIdentity { get; set; } - - [ForeignKey("UserMacroIdentityUserId")] - [InverseProperty("CmsUserMacroIdentity")] - public virtual CmsUser UserMacroIdentityUser { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsUserRole.cs b/Migration.Tool.KXP/Models/CmsUserRole.cs deleted file mode 100644 index 4bcfffbb..00000000 --- a/Migration.Tool.KXP/Models/CmsUserRole.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_UserRole")] -[Index("RoleId", Name = "IX_CMS_UserRole_RoleID")] -[Index("UserId", "RoleId", Name = "IX_CMS_UserRole_UserID_RoleID", IsUnique = true)] -public class CmsUserRole -{ - [Column("UserID")] - public int UserId { get; set; } - - [Column("RoleID")] - public int RoleId { get; set; } - - [Key] - [Column("UserRoleID")] - public int UserRoleId { get; set; } - - [ForeignKey("RoleId")] - [InverseProperty("CmsUserRoles")] - public virtual CmsRole Role { get; set; } = null!; - - [ForeignKey("UserId")] - [InverseProperty("CmsUserRoles")] - public virtual CmsUser User { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWebFarmServer.cs b/Migration.Tool.KXP/Models/CmsWebFarmServer.cs deleted file mode 100644 index d7a84be3..00000000 --- a/Migration.Tool.KXP/Models/CmsWebFarmServer.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebFarmServer")] -[Index("ServerName", Name = "IX_CMS_WebFarmServer_ServerName", IsUnique = true)] -public class CmsWebFarmServer -{ - [Key] - [Column("ServerID")] - public int ServerId { get; set; } - - [StringLength(300)] - public string ServerDisplayName { get; set; } = null!; - - [StringLength(300)] - public string ServerName { get; set; } = null!; - - [Column("ServerGUID")] - public Guid? ServerGuid { get; set; } - - public DateTime ServerLastModified { get; set; } - - public bool ServerEnabled { get; set; } - - [InverseProperty("Server")] - public virtual ICollection CmsWebFarmServerTasks { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsWebFarmServerLog.cs b/Migration.Tool.KXP/Models/CmsWebFarmServerLog.cs deleted file mode 100644 index 430ac533..00000000 --- a/Migration.Tool.KXP/Models/CmsWebFarmServerLog.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebFarmServerLog")] -public class CmsWebFarmServerLog -{ - [Key] - [Column("WebFarmServerLogID")] - public int WebFarmServerLogId { get; set; } - - public DateTime LogTime { get; set; } - - [StringLength(200)] - public string LogCode { get; set; } = null!; - - [Column("ServerID")] - public int ServerId { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsWebFarmServerMonitoring.cs b/Migration.Tool.KXP/Models/CmsWebFarmServerMonitoring.cs deleted file mode 100644 index 3a348422..00000000 --- a/Migration.Tool.KXP/Models/CmsWebFarmServerMonitoring.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebFarmServerMonitoring")] -public class CmsWebFarmServerMonitoring -{ - [Key] - [Column("WebFarmServerMonitoringID")] - public int WebFarmServerMonitoringId { get; set; } - - [Column("ServerID")] - public int ServerId { get; set; } - - public DateTime? ServerPing { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsWebFarmServerTask.cs b/Migration.Tool.KXP/Models/CmsWebFarmServerTask.cs deleted file mode 100644 index 50f8b485..00000000 --- a/Migration.Tool.KXP/Models/CmsWebFarmServerTask.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[PrimaryKey("ServerId", "TaskId")] -[Table("CMS_WebFarmServerTask")] -[Index("TaskId", Name = "IX_CMS_WebFarmServerTask_TaskID")] -public class CmsWebFarmServerTask -{ - [Key] - [Column("ServerID")] - public int ServerId { get; set; } - - [Key] - [Column("TaskID")] - public int TaskId { get; set; } - - public string? ErrorMessage { get; set; } - - [ForeignKey("ServerId")] - [InverseProperty("CmsWebFarmServerTasks")] - public virtual CmsWebFarmServer Server { get; set; } = null!; - - [ForeignKey("TaskId")] - [InverseProperty("CmsWebFarmServerTasks")] - public virtual CmsWebFarmTask Task { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWebFarmTask.cs b/Migration.Tool.KXP/Models/CmsWebFarmTask.cs deleted file mode 100644 index 54dad54b..00000000 --- a/Migration.Tool.KXP/Models/CmsWebFarmTask.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebFarmTask")] -[Index("TaskIsMemory", "TaskCreated", Name = "IX_CMS_WebFarmTask_TaskIsMemory_TaskCreated")] -public class CmsWebFarmTask -{ - [Key] - [Column("TaskID")] - public int TaskId { get; set; } - - [StringLength(100)] - public string TaskType { get; set; } = null!; - - public string? TaskTextData { get; set; } - - public byte[]? TaskBinaryData { get; set; } - - public DateTime? TaskCreated { get; set; } - - public string? TaskTarget { get; set; } - - [StringLength(450)] - public string? TaskMachineName { get; set; } - - [Column("TaskGUID")] - public Guid? TaskGuid { get; set; } - - public bool? TaskIsAnonymous { get; set; } - - public string? TaskErrorMessage { get; set; } - - public bool? TaskIsMemory { get; set; } - - [InverseProperty("Task")] - public virtual ICollection CmsWebFarmServerTasks { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsWebPageFormerUrlPath.cs b/Migration.Tool.KXP/Models/CmsWebPageFormerUrlPath.cs deleted file mode 100644 index d401b916..00000000 --- a/Migration.Tool.KXP/Models/CmsWebPageFormerUrlPath.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebPageFormerUrlPath")] -[Index("WebPageFormerUrlPathContentLanguageId", Name = "IX_CMS_WebPageFormerUrlPath_WebPageFormerUrlPathContentLanguageID")] -[Index("WebPageFormerUrlPathWebPageItemId", Name = "IX_CMS_WebPageFormerUrlPath_WebPageFormerUrlPathWebPageItemID")] -[Index("WebPageFormerUrlPathWebsiteChannelId", Name = "IX_CMS_WebPageFormerUrlPath_WebPageFormerUrlPathWebsiteChannelID")] -public class CmsWebPageFormerUrlPath -{ - [Key] - [Column("WebPageFormerUrlPathID")] - public int WebPageFormerUrlPathId { get; set; } - - [StringLength(2000)] - public string WebPageFormerUrlPath { get; set; } = null!; - - [StringLength(64)] - public string WebPageFormerUrlPathHash { get; set; } = null!; - - [Column("WebPageFormerUrlPathContentLanguageID")] - public int WebPageFormerUrlPathContentLanguageId { get; set; } - - [Column("WebPageFormerUrlPathWebPageItemID")] - public int WebPageFormerUrlPathWebPageItemId { get; set; } - - [Column("WebPageFormerUrlPathWebsiteChannelID")] - public int WebPageFormerUrlPathWebsiteChannelId { get; set; } - - public DateTime WebPageFormerUrlPathLastModified { get; set; } - - [ForeignKey("WebPageFormerUrlPathContentLanguageId")] - [InverseProperty("CmsWebPageFormerUrlPaths")] - public virtual CmsContentLanguage WebPageFormerUrlPathContentLanguage { get; set; } = null!; - - [ForeignKey("WebPageFormerUrlPathWebPageItemId")] - [InverseProperty("CmsWebPageFormerUrlPaths")] - public virtual CmsWebPageItem WebPageFormerUrlPathWebPageItem { get; set; } = null!; - - [ForeignKey("WebPageFormerUrlPathWebsiteChannelId")] - [InverseProperty("CmsWebPageFormerUrlPaths")] - public virtual CmsWebsiteChannel WebPageFormerUrlPathWebsiteChannel { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWebPageItem.cs b/Migration.Tool.KXP/Models/CmsWebPageItem.cs deleted file mode 100644 index 8b22d686..00000000 --- a/Migration.Tool.KXP/Models/CmsWebPageItem.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebPageItem")] -[Index("WebPageItemContentItemId", Name = "IX_CMS_WebPageItem_WebPageItemContentItemID")] -[Index("WebPageItemGuid", Name = "IX_CMS_WebPageItem_WebPageItemGUID_Unique", IsUnique = true)] -[Index("WebPageItemName", Name = "IX_CMS_WebPageItem_WebPageItemName_Unique", IsUnique = true)] -[Index("WebPageItemParentId", Name = "IX_CMS_WebPageItem_WebPageItemParentID")] -[Index("WebPageItemTreePath", "WebPageItemWebsiteChannelId", Name = "IX_CMS_WebPageItem_WebPageItemTreePath_WebPageItemWebsiteChannelID_Unique", IsUnique = true)] -[Index("WebPageItemWebsiteChannelId", Name = "IX_CMS_WebPageItem_WebPageItemWebsiteChannelID")] -public class CmsWebPageItem -{ - [Key] - [Column("WebPageItemID")] - public int WebPageItemId { get; set; } - - [Column("WebPageItemParentID")] - public int? WebPageItemParentId { get; set; } - - [Column("WebPageItemGUID")] - public Guid WebPageItemGuid { get; set; } - - [StringLength(100)] - public string WebPageItemName { get; set; } = null!; - - [StringLength(850)] - public string WebPageItemTreePath { get; set; } = null!; - - [Column("WebPageItemWebsiteChannelID")] - public int WebPageItemWebsiteChannelId { get; set; } - - [Column("WebPageItemContentItemID")] - public int? WebPageItemContentItemId { get; set; } - - public int? WebPageItemOrder { get; set; } - - [InverseProperty("WebPageFormerUrlPathWebPageItem")] - public virtual ICollection CmsWebPageFormerUrlPaths { get; set; } = new List(); - - [InverseProperty("WebPageUrlPathWebPageItem")] - public virtual ICollection CmsWebPageUrlPaths { get; set; } = new List(); - - [InverseProperty("WebPageItemParent")] - public virtual ICollection InverseWebPageItemParent { get; set; } = new List(); - - [ForeignKey("WebPageItemContentItemId")] - [InverseProperty("CmsWebPageItems")] - public virtual CmsContentItem? WebPageItemContentItem { get; set; } - - [ForeignKey("WebPageItemParentId")] - [InverseProperty("InverseWebPageItemParent")] - public virtual CmsWebPageItem? WebPageItemParent { get; set; } - - [ForeignKey("WebPageItemWebsiteChannelId")] - [InverseProperty("CmsWebPageItems")] - public virtual CmsWebsiteChannel WebPageItemWebsiteChannel { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWebPageUrlPath.cs b/Migration.Tool.KXP/Models/CmsWebPageUrlPath.cs deleted file mode 100644 index 3b8b993c..00000000 --- a/Migration.Tool.KXP/Models/CmsWebPageUrlPath.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebPageUrlPath")] -[Index("WebPageUrlPathContentLanguageId", Name = "IX_CMS_WebPageUrlPath_WebPageUrlPathContentLanguageID")] -[Index("WebPageUrlPathHash", "WebPageUrlPathWebsiteChannelId", "WebPageUrlPathContentLanguageId", "WebPageUrlPathIsDraft", - Name = "IX_CMS_WebPageUrlPath_WebPageUrlPathHash_WebPageUrlPathWebsiteChannelID_WebPageUrlPathContentLanguageID_WebPageUrlPathIsDraft", IsUnique = true)] -[Index("WebPageUrlPathWebPageItemId", Name = "IX_CMS_WebPageUrlPath_WebPageUrlPathWebPageItemID")] -[Index("WebPageUrlPathWebsiteChannelId", Name = "IX_CMS_WebPageUrlPath_WebPageUrlPathWebsiteChannelID")] -public class CmsWebPageUrlPath -{ - [Key] - [Column("WebPageUrlPathID")] - public int WebPageUrlPathId { get; set; } - - [StringLength(2000)] - public string WebPageUrlPath { get; set; } = null!; - - [StringLength(64)] - public string WebPageUrlPathHash { get; set; } = null!; - - [Column("WebPageUrlPathWebPageItemID")] - public int WebPageUrlPathWebPageItemId { get; set; } - - public bool WebPageUrlPathIsLatest { get; set; } - - [Column("WebPageUrlPathGUID")] - public Guid WebPageUrlPathGuid { get; set; } - - [Column("WebPageUrlPathWebsiteChannelID")] - public int WebPageUrlPathWebsiteChannelId { get; set; } - - [Column("WebPageUrlPathContentLanguageID")] - public int WebPageUrlPathContentLanguageId { get; set; } - - public bool WebPageUrlPathIsDraft { get; set; } - - [ForeignKey("WebPageUrlPathContentLanguageId")] - [InverseProperty("CmsWebPageUrlPaths")] - public virtual CmsContentLanguage WebPageUrlPathContentLanguage { get; set; } = null!; - - [ForeignKey("WebPageUrlPathWebPageItemId")] - [InverseProperty("CmsWebPageUrlPaths")] - public virtual CmsWebPageItem WebPageUrlPathWebPageItem { get; set; } = null!; - - [ForeignKey("WebPageUrlPathWebsiteChannelId")] - [InverseProperty("CmsWebPageUrlPaths")] - public virtual CmsWebsiteChannel WebPageUrlPathWebsiteChannel { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWebsiteCaptchaSetting.cs b/Migration.Tool.KXP/Models/CmsWebsiteCaptchaSetting.cs deleted file mode 100644 index 5ed808e5..00000000 --- a/Migration.Tool.KXP/Models/CmsWebsiteCaptchaSetting.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebsiteCaptchaSettings")] -public class CmsWebsiteCaptchaSetting -{ - [Key] - [Column("WebsiteCaptchaSettingsID")] - public int WebsiteCaptchaSettingsId { get; set; } - - [Column("WebsiteCaptchaSettingsWebsiteChannelID")] - public int WebsiteCaptchaSettingsWebsiteChannelId { get; set; } - - [StringLength(200)] - public string WebsiteCaptchaSettingsReCaptchaSiteKey { get; set; } = null!; - - [StringLength(200)] - public string WebsiteCaptchaSettingsReCaptchaSecretKey { get; set; } = null!; - - public double? WebsiteCaptchaSettingsReCaptchaThreshold { get; set; } - - public int WebsiteCaptchaSettingsReCaptchaVersion { get; set; } - - [Column("WebsiteCaptchaSettingsGUID")] - public Guid WebsiteCaptchaSettingsGuid { get; set; } -} diff --git a/Migration.Tool.KXP/Models/CmsWebsiteChannel.cs b/Migration.Tool.KXP/Models/CmsWebsiteChannel.cs deleted file mode 100644 index 58bd8c52..00000000 --- a/Migration.Tool.KXP/Models/CmsWebsiteChannel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WebsiteChannel")] -[Index("WebsiteChannelChannelId", Name = "IX_CMS_WebsiteChannel_WebsiteChannelChannelID")] -[Index("WebsiteChannelPrimaryContentLanguageId", Name = "IX_CMS_WebsiteChannel_WebsiteChannelPrimaryContentLanguageID")] -public class CmsWebsiteChannel -{ - [Key] - [Column("WebsiteChannelID")] - public int WebsiteChannelId { get; set; } - - [Column("WebsiteChannelGUID")] - public Guid WebsiteChannelGuid { get; set; } - - [StringLength(400)] - public string WebsiteChannelDomain { get; set; } = null!; - - [Column("WebsiteChannelChannelID")] - public int WebsiteChannelChannelId { get; set; } - - [StringLength(200)] - public string? WebsiteChannelHomePage { get; set; } - - [Column("WebsiteChannelPrimaryContentLanguageID")] - public int WebsiteChannelPrimaryContentLanguageId { get; set; } - - public int WebsiteChannelDefaultCookieLevel { get; set; } - - public bool WebsiteChannelStoreFormerUrls { get; set; } - - [InverseProperty("WebPageFormerUrlPathWebsiteChannel")] - public virtual ICollection CmsWebPageFormerUrlPaths { get; set; } = new List(); - - [InverseProperty("WebPageItemWebsiteChannel")] - public virtual ICollection CmsWebPageItems { get; set; } = new List(); - - [InverseProperty("WebPageUrlPathWebsiteChannel")] - public virtual ICollection CmsWebPageUrlPaths { get; set; } = new List(); - - [ForeignKey("WebsiteChannelChannelId")] - [InverseProperty("CmsWebsiteChannels")] - public virtual CmsChannel WebsiteChannelChannel { get; set; } = null!; - - [ForeignKey("WebsiteChannelPrimaryContentLanguageId")] - [InverseProperty("CmsWebsiteChannels")] - public virtual CmsContentLanguage WebsiteChannelPrimaryContentLanguage { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWorkflow.cs b/Migration.Tool.KXP/Models/CmsWorkflow.cs deleted file mode 100644 index 0eb5dd44..00000000 --- a/Migration.Tool.KXP/Models/CmsWorkflow.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_Workflow")] -public class CmsWorkflow -{ - [Key] - [Column("WorkflowID")] - public int WorkflowId { get; set; } - - public string WorkflowDisplayName { get; set; } = null!; - - [StringLength(450)] - public string WorkflowName { get; set; } = null!; - - [Column("WorkflowGUID")] - public Guid WorkflowGuid { get; set; } - - public DateTime WorkflowLastModified { get; set; } - - public bool? WorkflowAutoPublishChanges { get; set; } - - public bool? WorkflowUseCheckinCheckout { get; set; } - - public int? WorkflowType { get; set; } - - public bool? WorkflowSendEmails { get; set; } - - public bool? WorkflowSendApproveEmails { get; set; } - - public bool? WorkflowSendRejectEmails { get; set; } - - public bool? WorkflowSendPublishEmails { get; set; } - - public bool? WorkflowSendArchiveEmails { get; set; } - - [StringLength(200)] - public string? WorkflowApprovedTemplateName { get; set; } - - [StringLength(200)] - public string? WorkflowRejectedTemplateName { get; set; } - - [StringLength(200)] - public string? WorkflowPublishedTemplateName { get; set; } - - [StringLength(200)] - public string? WorkflowArchivedTemplateName { get; set; } - - public bool? WorkflowSendReadyForApprovalEmails { get; set; } - - [StringLength(200)] - public string? WorkflowReadyForApprovalTemplateName { get; set; } - - [StringLength(200)] - public string? WorkflowNotificationTemplateName { get; set; } - - public string? WorkflowAllowedObjects { get; set; } - - public int? WorkflowRecurrenceType { get; set; } - - public bool WorkflowEnabled { get; set; } - - [InverseProperty("HistoryWorkflow")] - public virtual ICollection CmsAutomationHistories { get; set; } = new List(); - - [InverseProperty("StateWorkflow")] - public virtual ICollection CmsAutomationStates { get; set; } = new List(); - - [InverseProperty("TriggerWorkflow")] - public virtual ICollection CmsObjectWorkflowTriggers { get; set; } = new List(); - - [InverseProperty("StepWorkflow")] - public virtual ICollection CmsWorkflowSteps { get; set; } = new List(); - - [InverseProperty("TransitionWorkflow")] - public virtual ICollection CmsWorkflowTransitions { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsWorkflowAction.cs b/Migration.Tool.KXP/Models/CmsWorkflowAction.cs deleted file mode 100644 index bf00a72a..00000000 --- a/Migration.Tool.KXP/Models/CmsWorkflowAction.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WorkflowAction")] -[Index("ActionResourceId", Name = "IX_CMS_WorkflowAction_ActionResourceID")] -public class CmsWorkflowAction -{ - [Key] - [Column("ActionID")] - public int ActionId { get; set; } - - [StringLength(200)] - public string ActionDisplayName { get; set; } = null!; - - [StringLength(200)] - public string ActionName { get; set; } = null!; - - public string? ActionParameters { get; set; } - - public string? ActionDescription { get; set; } - - [StringLength(200)] - public string ActionAssemblyName { get; set; } = null!; - - [StringLength(200)] - public string ActionClass { get; set; } = null!; - - [Column("ActionResourceID")] - public int? ActionResourceId { get; set; } - - [Column("ActionGUID")] - public Guid ActionGuid { get; set; } - - public DateTime ActionLastModified { get; set; } - - public bool ActionEnabled { get; set; } - - public string? ActionAllowedObjects { get; set; } - - public int? ActionWorkflowType { get; set; } - - [StringLength(200)] - public string? ActionIconClass { get; set; } - - [StringLength(200)] - public string? ActionThumbnailClass { get; set; } - - [StringLength(200)] - public string? ActionDataProviderClass { get; set; } - - [StringLength(200)] - public string? ActionDataProviderAssemblyName { get; set; } - - [ForeignKey("ActionResourceId")] - [InverseProperty("CmsWorkflowActions")] - public virtual CmsResource? ActionResource { get; set; } - - [InverseProperty("StepAction")] - public virtual ICollection CmsWorkflowSteps { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/CmsWorkflowStep.cs b/Migration.Tool.KXP/Models/CmsWorkflowStep.cs deleted file mode 100644 index 90798a9e..00000000 --- a/Migration.Tool.KXP/Models/CmsWorkflowStep.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WorkflowStep")] -[Index("StepActionId", Name = "IX_CMS_WorkflowStep_StepActionID")] -[Index("StepId", "StepName", Name = "IX_CMS_WorkflowStep_StepID_StepName")] -[Index("StepWorkflowId", "StepName", Name = "IX_CMS_WorkflowStep_StepWorkflowID_StepName", IsUnique = true)] -[Index("StepWorkflowId", "StepOrder", Name = "IX_CMS_WorkflowStep_StepWorkflowID_StepOrder")] -public class CmsWorkflowStep -{ - [Key] - [Column("StepID")] - public int StepId { get; set; } - - [StringLength(450)] - public string StepDisplayName { get; set; } = null!; - - [StringLength(440)] - public string? StepName { get; set; } - - public int? StepOrder { get; set; } - - [Column("StepWorkflowID")] - public int StepWorkflowId { get; set; } - - [Column("StepGUID")] - public Guid StepGuid { get; set; } - - public DateTime StepLastModified { get; set; } - - public int? StepType { get; set; } - - public bool? StepAllowReject { get; set; } - - public string? StepDefinition { get; set; } - - public int? StepRolesSecurity { get; set; } - - public int? StepUsersSecurity { get; set; } - - [StringLength(200)] - public string? StepApprovedTemplateName { get; set; } - - [StringLength(200)] - public string? StepRejectedTemplateName { get; set; } - - [StringLength(200)] - public string? StepReadyforApprovalTemplateName { get; set; } - - public bool? StepSendApproveEmails { get; set; } - - public bool? StepSendRejectEmails { get; set; } - - public bool? StepSendReadyForApprovalEmails { get; set; } - - public bool? StepSendEmails { get; set; } - - public bool? StepAllowPublish { get; set; } - - [Column("StepActionID")] - public int? StepActionId { get; set; } - - public string? StepActionParameters { get; set; } - - public int? StepWorkflowType { get; set; } - - [InverseProperty("HistoryStep")] - public virtual ICollection CmsAutomationHistoryHistorySteps { get; set; } = new List(); - - [InverseProperty("HistoryTargetStep")] - public virtual ICollection CmsAutomationHistoryHistoryTargetSteps { get; set; } = new List(); - - [InverseProperty("StateStep")] - public virtual ICollection CmsAutomationStates { get; set; } = new List(); - - [InverseProperty("TransitionEndStep")] - public virtual ICollection CmsWorkflowTransitionTransitionEndSteps { get; set; } = new List(); - - [InverseProperty("TransitionStartStep")] - public virtual ICollection CmsWorkflowTransitionTransitionStartSteps { get; set; } = new List(); - - [ForeignKey("StepActionId")] - [InverseProperty("CmsWorkflowSteps")] - public virtual CmsWorkflowAction? StepAction { get; set; } - - [ForeignKey("StepWorkflowId")] - [InverseProperty("CmsWorkflowSteps")] - public virtual CmsWorkflow StepWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/CmsWorkflowTransition.cs b/Migration.Tool.KXP/Models/CmsWorkflowTransition.cs deleted file mode 100644 index c494c665..00000000 --- a/Migration.Tool.KXP/Models/CmsWorkflowTransition.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("CMS_WorkflowTransition")] -[Index("TransitionEndStepId", Name = "IX_CMS_WorkflowTransition_TransitionEndStepID")] -[Index("TransitionStartStepId", "TransitionSourcePointGuid", "TransitionEndStepId", Name = "IX_CMS_WorkflowTransition_TransitionStartStepID_TransitionSourcePointGUID_TransitionEndStepID", IsUnique = true)] -[Index("TransitionWorkflowId", Name = "IX_CMS_WorkflowTransition_TransitionWorkflowID")] -public class CmsWorkflowTransition -{ - [Key] - [Column("TransitionID")] - public int TransitionId { get; set; } - - [Column("TransitionStartStepID")] - public int TransitionStartStepId { get; set; } - - [Column("TransitionEndStepID")] - public int TransitionEndStepId { get; set; } - - public int TransitionType { get; set; } - - public DateTime TransitionLastModified { get; set; } - - [Column("TransitionSourcePointGUID")] - public Guid? TransitionSourcePointGuid { get; set; } - - [Column("TransitionWorkflowID")] - public int TransitionWorkflowId { get; set; } - - [ForeignKey("TransitionEndStepId")] - [InverseProperty("CmsWorkflowTransitionTransitionEndSteps")] - public virtual CmsWorkflowStep TransitionEndStep { get; set; } = null!; - - [ForeignKey("TransitionStartStepId")] - [InverseProperty("CmsWorkflowTransitionTransitionStartSteps")] - public virtual CmsWorkflowStep TransitionStartStep { get; set; } = null!; - - [ForeignKey("TransitionWorkflowId")] - [InverseProperty("CmsWorkflowTransitions")] - public virtual CmsWorkflow TransitionWorkflow { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailBounce.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailBounce.cs deleted file mode 100644 index 23161a28..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailBounce.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailBounce")] -[Index("EmailBounceEmailAddress", Name = "IX_EmailLibrary_EmailBounce_EmailBounceEmailAddress", IsUnique = true)] -public class EmailLibraryEmailBounce -{ - [Key] - [Column("EmailBounceID")] - public int EmailBounceId { get; set; } - - [StringLength(256)] - public string EmailBounceEmailAddress { get; set; } = null!; - - public bool EmailBounceIsHardBounce { get; set; } - - public int EmailBounceSoftBounceCount { get; set; } -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailChannel.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailChannel.cs deleted file mode 100644 index cc2b9d43..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailChannel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailChannel")] -[Index("EmailChannelChannelId", Name = "IX_EmailLibrary_EmailChannel_EmailChannelChannelID")] -public class EmailLibraryEmailChannel -{ - [Key] - [Column("EmailChannelID")] - public int EmailChannelId { get; set; } - - [Column("EmailChannelGUID")] - public Guid EmailChannelGuid { get; set; } - - [Column("EmailChannelChannelID")] - public int EmailChannelChannelId { get; set; } - - [StringLength(252)] - public string EmailChannelSendingDomain { get; set; } = null!; - - [StringLength(400)] - public string EmailChannelServiceDomain { get; set; } = null!; - - [Column("EmailChannelPrimaryContentLanguageID")] - public int EmailChannelPrimaryContentLanguageId { get; set; } - - [ForeignKey("EmailChannelChannelId")] - [InverseProperty("EmailLibraryEmailChannels")] - public virtual CmsChannel EmailChannelChannel { get; set; } = null!; - - [InverseProperty("EmailChannelSenderEmailChannel")] - public virtual ICollection EmailLibraryEmailChannelSenders { get; set; } = new List(); - - [InverseProperty("EmailConfigurationEmailChannel")] - public virtual ICollection EmailLibraryEmailConfigurations { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailChannelSender.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailChannelSender.cs deleted file mode 100644 index 7aff1933..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailChannelSender.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailChannelSender")] -[Index("EmailChannelSenderEmailChannelId", Name = "IX_EmailLibrary_EmailChannelSender_EmailChannelSenderEmailChannelID")] -public class EmailLibraryEmailChannelSender -{ - [Key] - [Column("EmailChannelSenderID")] - public int EmailChannelSenderId { get; set; } - - [Column("EmailChannelSenderEmailChannelID")] - public int EmailChannelSenderEmailChannelId { get; set; } - - [StringLength(250)] - public string EmailChannelSenderName { get; set; } = null!; - - [StringLength(250)] - public string EmailChannelSenderDisplayName { get; set; } = null!; - - [Column("EmailChannelSenderGUID")] - public Guid EmailChannelSenderGuid { get; set; } - - public DateTime EmailChannelSenderCreated { get; set; } - - [ForeignKey("EmailChannelSenderEmailChannelId")] - [InverseProperty("EmailLibraryEmailChannelSenders")] - public virtual EmailLibraryEmailChannel EmailChannelSenderEmailChannel { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailConfiguration.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailConfiguration.cs deleted file mode 100644 index 056d8d46..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailConfiguration.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailConfiguration")] -[Index("EmailConfigurationContentItemId", Name = "IX_EmailLibrary_EmailConfiguration_EmailConfigurationContentItemID")] -[Index("EmailConfigurationEmailChannelId", Name = "IX_EmailLibrary_EmailConfiguration_EmailConfigurationEmailChannelID")] -public class EmailLibraryEmailConfiguration -{ - [Key] - [Column("EmailConfigurationID")] - public int EmailConfigurationId { get; set; } - - [StringLength(250)] - public string EmailConfigurationName { get; set; } = null!; - - [Column("EmailConfigurationGUID")] - public Guid EmailConfigurationGuid { get; set; } - - public DateTime EmailConfigurationLastModified { get; set; } - - [StringLength(50)] - public string EmailConfigurationPurpose { get; set; } = null!; - - [Column("EmailConfigurationEmailChannelID")] - public int? EmailConfigurationEmailChannelId { get; set; } - - [Column("EmailConfigurationContentItemID")] - public int? EmailConfigurationContentItemId { get; set; } - - [InverseProperty("EmailEmailConfiguration")] - public virtual ICollection CmsEmails { get; set; } = new List(); - - [ForeignKey("EmailConfigurationContentItemId")] - [InverseProperty("EmailLibraryEmailConfigurations")] - public virtual CmsContentItem? EmailConfigurationContentItem { get; set; } - - [ForeignKey("EmailConfigurationEmailChannelId")] - [InverseProperty("EmailLibraryEmailConfigurations")] - public virtual EmailLibraryEmailChannel? EmailConfigurationEmailChannel { get; set; } - - [InverseProperty("EmailLinkEmailConfiguration")] - public virtual ICollection EmailLibraryEmailLinks { get; set; } = new List(); - - [InverseProperty("EmailMarketingRecipientEmailConfiguration")] - public virtual ICollection EmailLibraryEmailMarketingRecipients { get; set; } = new List(); - - [InverseProperty("EmailStatisticsEmailConfiguration")] - public virtual ICollection EmailLibraryEmailStatistics { get; set; } = new List(); - - [InverseProperty("EmailStatisticsHitsEmailConfiguration")] - public virtual ICollection EmailLibraryEmailStatisticsHits { get; set; } = new List(); - - [InverseProperty("SendConfigurationEmailConfiguration")] - public virtual EmailLibrarySendConfiguration? EmailLibrarySendConfiguration { get; set; } -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailLink.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailLink.cs deleted file mode 100644 index 906e5496..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailLink.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailLink")] -[Index("EmailLinkEmailConfigurationId", Name = "IX_EmailLibrary_EmailLink_EmailLinkEmailConfigurationID")] -public class EmailLibraryEmailLink -{ - [Key] - [Column("EmailLinkID")] - public int EmailLinkId { get; set; } - - [Column("EmailLinkEmailConfigurationID")] - public int EmailLinkEmailConfigurationId { get; set; } - - public string EmailLinkTarget { get; set; } = null!; - - [StringLength(450)] - public string EmailLinkDescription { get; set; } = null!; - - [Column("EmailLinkGUID")] - public Guid EmailLinkGuid { get; set; } - - [InverseProperty("EmailStatisticsHitsEmailLink")] - public virtual ICollection EmailLibraryEmailStatisticsHits { get; set; } = new List(); - - [ForeignKey("EmailLinkEmailConfigurationId")] - [InverseProperty("EmailLibraryEmailLinks")] - public virtual EmailLibraryEmailConfiguration EmailLinkEmailConfiguration { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailMarketingRecipient.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailMarketingRecipient.cs deleted file mode 100644 index 410d06eb..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailMarketingRecipient.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailMarketingRecipient")] -[Index("EmailMarketingRecipientContactId", Name = "IX_EmailLibrary_EmailMarketingRecipient_EmailMarketingRecipientContactID")] -[Index("EmailMarketingRecipientEmailConfigurationId", Name = "IX_EmailLibrary_EmailMarketingRecipient_EmailMarketingRecipientEmailConfigurationID")] -public class EmailLibraryEmailMarketingRecipient -{ - [Key] - [Column("EmailMarketingRecipientID")] - public int EmailMarketingRecipientId { get; set; } - - [Column("EmailMarketingRecipientEmailConfigurationID")] - public int EmailMarketingRecipientEmailConfigurationId { get; set; } - - [Column("EmailMarketingRecipientContactID")] - public int EmailMarketingRecipientContactId { get; set; } - - [StringLength(254)] - public string EmailMarketingRecipientContactEmail { get; set; } = null!; - - public int EmailMarketingRecipientStatus { get; set; } - - [StringLength(500)] - public string? EmailMarketingRecipientErrorMessage { get; set; } - - public DateTime EmailMarketingRecipientLastModified { get; set; } - - public int EmailMarketingRecipientRetryAttempt { get; set; } - - [ForeignKey("EmailMarketingRecipientContactId")] - [InverseProperty("EmailLibraryEmailMarketingRecipients")] - public virtual OmContact EmailMarketingRecipientContact { get; set; } = null!; - - [ForeignKey("EmailMarketingRecipientEmailConfigurationId")] - [InverseProperty("EmailLibraryEmailMarketingRecipients")] - public virtual EmailLibraryEmailConfiguration EmailMarketingRecipientEmailConfiguration { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailStatistic.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailStatistic.cs deleted file mode 100644 index d4a22d46..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailStatistic.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailStatistics")] -[Index("EmailStatisticsEmailConfigurationId", Name = "IX_EmailLibrary_EmailStatistics_EmailStatisticsEmailConfigurationID")] -public class EmailLibraryEmailStatistic -{ - [Key] - [Column("EmailStatisticsID")] - public int EmailStatisticsId { get; set; } - - [Column("EmailStatisticsEmailConfigurationID")] - public int EmailStatisticsEmailConfigurationId { get; set; } - - public int EmailStatisticsEmailOpens { get; set; } - - public int EmailStatisticsEmailUniqueOpens { get; set; } - - public int EmailStatisticsEmailClicks { get; set; } - - public int EmailStatisticsEmailUniqueClicks { get; set; } - - public int EmailStatisticsTotalSent { get; set; } - - public int? EmailStatisticsEmailSoftBounces { get; set; } - - public int? EmailStatisticsEmailHardBounces { get; set; } - - public int EmailStatisticsEmailsDelivered { get; set; } - - public int EmailStatisticsUniqueUnsubscribes { get; set; } - - public int? EmailStatisticsSpamReports { get; set; } - - [ForeignKey("EmailStatisticsEmailConfigurationId")] - [InverseProperty("EmailLibraryEmailStatistics")] - public virtual EmailLibraryEmailConfiguration EmailStatisticsEmailConfiguration { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailStatisticsHit.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailStatisticsHit.cs deleted file mode 100644 index 97af2d20..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailStatisticsHit.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailStatisticsHits")] -[Index("EmailStatisticsHitsEmailConfigurationId", Name = "IX_EmailLibrary_EmailStatisticsHits_EmailStatisticsHitsEmailConfigurationID")] -[Index("EmailStatisticsHitsEmailLinkId", Name = "IX_EmailLibrary_EmailStatisticsHits_EmailStatisticsHitsEmailLinkID")] -public class EmailLibraryEmailStatisticsHit -{ - [Key] - [Column("EmailStatisticsHitsID")] - public long EmailStatisticsHitsId { get; set; } - - [Column("EmailStatisticsHitsEmailConfigurationID")] - public int EmailStatisticsHitsEmailConfigurationId { get; set; } - - public int EmailStatisticsHitsType { get; set; } - - public DateTime EmailStatisticsHitsTime { get; set; } - - [Column("EmailStatisticsHitsMailoutGUID")] - public Guid EmailStatisticsHitsMailoutGuid { get; set; } - - [Column("EmailStatisticsHitsEmailLinkID")] - public int? EmailStatisticsHitsEmailLinkId { get; set; } - - [ForeignKey("EmailStatisticsHitsEmailConfigurationId")] - [InverseProperty("EmailLibraryEmailStatisticsHits")] - public virtual EmailLibraryEmailConfiguration EmailStatisticsHitsEmailConfiguration { get; set; } = null!; - - [ForeignKey("EmailStatisticsHitsEmailLinkId")] - [InverseProperty("EmailLibraryEmailStatisticsHits")] - public virtual EmailLibraryEmailLink? EmailStatisticsHitsEmailLink { get; set; } -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailSubscriptionConfirmation.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailSubscriptionConfirmation.cs deleted file mode 100644 index 2ea9fbca..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailSubscriptionConfirmation.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailSubscriptionConfirmation")] -[Index("EmailSubscriptionConfirmationContactId", Name = "IX_EmailLibrary_EmailSubscriptionConfirmation_EmailSubscriptionConfirmationContactID")] -[Index("EmailSubscriptionConfirmationRecipientListId", Name = "IX_EmailLibrary_EmailSubscriptionConfirmation_EmailSubscriptionConfirmationRecipientListID")] -public class EmailLibraryEmailSubscriptionConfirmation -{ - [Key] - [Column("EmailSubscriptionConfirmationID")] - public int EmailSubscriptionConfirmationId { get; set; } - - [Column("EmailSubscriptionConfirmationContactID")] - public int EmailSubscriptionConfirmationContactId { get; set; } - - [Column("EmailSubscriptionConfirmationRecipientListID")] - public int EmailSubscriptionConfirmationRecipientListId { get; set; } - - public bool EmailSubscriptionConfirmationIsApproved { get; set; } - - public DateTime EmailSubscriptionConfirmationDate { get; set; } - - [Column("EmailSubscriptionConfirmationGUID")] - public Guid EmailSubscriptionConfirmationGuid { get; set; } - - [ForeignKey("EmailSubscriptionConfirmationContactId")] - [InverseProperty("EmailLibraryEmailSubscriptionConfirmations")] - public virtual OmContact EmailSubscriptionConfirmationContact { get; set; } = null!; - - [ForeignKey("EmailSubscriptionConfirmationRecipientListId")] - [InverseProperty("EmailLibraryEmailSubscriptionConfirmations")] - public virtual OmContactGroup EmailSubscriptionConfirmationRecipientList { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailTemplate.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailTemplate.cs deleted file mode 100644 index 220145b8..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailTemplate.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailTemplate")] -public class EmailLibraryEmailTemplate -{ - [Key] - [Column("EmailTemplateID")] - public int EmailTemplateId { get; set; } - - [StringLength(250)] - public string EmailTemplateName { get; set; } = null!; - - [StringLength(250)] - public string EmailTemplateDisplayName { get; set; } = null!; - - public string? EmailTemplateDescription { get; set; } - - public string EmailTemplateCode { get; set; } = null!; - - public Guid EmailTemplateGuid { get; set; } - - public DateTime EmailTemplateLastModified { get; set; } - - [InverseProperty("EmailTemplateContentTypeEmailTemplate")] - public virtual ICollection EmailLibraryEmailTemplateContentTypes { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryEmailTemplateContentType.cs b/Migration.Tool.KXP/Models/EmailLibraryEmailTemplateContentType.cs deleted file mode 100644 index 985f13e5..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryEmailTemplateContentType.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_EmailTemplateContentType")] -[Index("EmailTemplateContentTypeContentTypeId", Name = "IX_EmailLibrary_EmailTemplateContentType_EmailTemplateContentTypeContentTypeID")] -[Index("EmailTemplateContentTypeEmailTemplateId", Name = "IX_EmailLibrary_EmailTemplateContentType_EmailTemplateContentTypeEmailTemplateID")] -public class EmailLibraryEmailTemplateContentType -{ - [Key] - [Column("EmailTemplateContentTypeID")] - public int EmailTemplateContentTypeId { get; set; } - - [Column("EmailTemplateContentTypeContentTypeID")] - public int EmailTemplateContentTypeContentTypeId { get; set; } - - [Column("EmailTemplateContentTypeEmailTemplateID")] - public int EmailTemplateContentTypeEmailTemplateId { get; set; } - - [ForeignKey("EmailTemplateContentTypeContentTypeId")] - [InverseProperty("EmailLibraryEmailTemplateContentTypes")] - public virtual CmsClass EmailTemplateContentTypeContentType { get; set; } = null!; - - [ForeignKey("EmailTemplateContentTypeEmailTemplateId")] - [InverseProperty("EmailLibraryEmailTemplateContentTypes")] - public virtual EmailLibraryEmailTemplate EmailTemplateContentTypeEmailTemplate { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibraryRecipientListSetting.cs b/Migration.Tool.KXP/Models/EmailLibraryRecipientListSetting.cs deleted file mode 100644 index 8e505d59..00000000 --- a/Migration.Tool.KXP/Models/EmailLibraryRecipientListSetting.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_RecipientListSettings")] -[Index("RecipientListSettingsRecipientListId", Name = "IX_EmailLibrary_RecipientListSettings_RecipientListSettingsRecipientListID")] -public class EmailLibraryRecipientListSetting -{ - [Key] - [Column("RecipientListSettingsID")] - public int RecipientListSettingsId { get; set; } - - [Column("RecipientListSettingsRecipientListID")] - public int RecipientListSettingsRecipientListId { get; set; } - - public Guid? RecipientListSettingsAfterUnsubscriptionPage { get; set; } - - public bool RecipientListSettingsSendUnsubscriptionConfirmationEmail { get; set; } - - [Column("RecipientListSettingsUnsubscriptionConfirmationEmailID")] - public int? RecipientListSettingsUnsubscriptionConfirmationEmailId { get; set; } - - public Guid? RecipientListSettingsAfterConfirmationPage { get; set; } - - public bool RecipientListSettingsSendSubscriptionConfirmationEmail { get; set; } - - [Column("RecipientListSettingsSubscriptionConfirmationEmailID")] - public int? RecipientListSettingsSubscriptionConfirmationEmailId { get; set; } - - [Column("RecipientListSettingsGUID")] - public Guid RecipientListSettingsGuid { get; set; } - - [ForeignKey("RecipientListSettingsRecipientListId")] - [InverseProperty("EmailLibraryRecipientListSettings")] - public virtual OmContactGroup RecipientListSettingsRecipientList { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/EmailLibrarySendConfiguration.cs b/Migration.Tool.KXP/Models/EmailLibrarySendConfiguration.cs deleted file mode 100644 index 17cd044b..00000000 --- a/Migration.Tool.KXP/Models/EmailLibrarySendConfiguration.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("EmailLibrary_SendConfiguration")] -[Index("SendConfigurationEmailConfigurationId", Name = "IX_EmailLibrary_SendConfiguration_SendConfigurationEmailConfigurationID")] -[Index("SendConfigurationRecipientListId", Name = "IX_EmailLibrary_SendConfiguration_SendConfigurationRecipientListID")] -[Index("SendConfigurationEmailConfigurationId", Name = "UQ_EmailLibrary_SendConfiguration_SendConfigurationEmailConfigurationID", IsUnique = true)] -public class EmailLibrarySendConfiguration -{ - [Key] - [Column("SendConfigurationID")] - public int SendConfigurationId { get; set; } - - [Column("SendConfigurationEmailConfigurationID")] - public int SendConfigurationEmailConfigurationId { get; set; } - - [Column("SendConfigurationRecipientListID")] - public int SendConfigurationRecipientListId { get; set; } - - public DateTime? SendConfigurationScheduledTime { get; set; } - - [Column("SendConfigurationGUID")] - public Guid SendConfigurationGuid { get; set; } - - public int SendConfigurationStatus { get; set; } - - [ForeignKey("SendConfigurationEmailConfigurationId")] - [InverseProperty("EmailLibrarySendConfiguration")] - public virtual EmailLibraryEmailConfiguration SendConfigurationEmailConfiguration { get; set; } = null!; - - [ForeignKey("SendConfigurationRecipientListId")] - [InverseProperty("EmailLibrarySendConfigurations")] - public virtual OmContactGroup SendConfigurationRecipientList { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/MediaFile.cs b/Migration.Tool.KXP/Models/MediaFile.cs deleted file mode 100644 index 66f9a3fb..00000000 --- a/Migration.Tool.KXP/Models/MediaFile.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("Media_File")] -[Index("FileCreatedByUserId", Name = "IX_Media_File_FileCreatedByUserID")] -[Index("FileGuid", Name = "IX_Media_File_FileGUID")] -[Index("FileLibraryId", Name = "IX_Media_File_FileLibraryID")] -[Index("FileModifiedByUserId", Name = "IX_Media_File_FileModifiedByUserID")] -public class MediaFile -{ - [Key] - [Column("FileID")] - public int FileId { get; set; } - - [StringLength(250)] - public string FileName { get; set; } = null!; - - [StringLength(250)] - public string FileTitle { get; set; } = null!; - - public string FileDescription { get; set; } = null!; - - [StringLength(50)] - public string FileExtension { get; set; } = null!; - - [StringLength(100)] - public string FileMimeType { get; set; } = null!; - - public string FilePath { get; set; } = null!; - - public long FileSize { get; set; } - - public int? FileImageWidth { get; set; } - - public int? FileImageHeight { get; set; } - - [Column("FileGUID")] - public Guid FileGuid { get; set; } - - [Column("FileLibraryID")] - public int FileLibraryId { get; set; } - - [Column("FileCreatedByUserID")] - public int? FileCreatedByUserId { get; set; } - - public DateTime FileCreatedWhen { get; set; } - - [Column("FileModifiedByUserID")] - public int? FileModifiedByUserId { get; set; } - - public DateTime FileModifiedWhen { get; set; } - - public string? FileCustomData { get; set; } - - [ForeignKey("FileCreatedByUserId")] - [InverseProperty("MediaFileFileCreatedByUsers")] - public virtual CmsUser? FileCreatedByUser { get; set; } - - [ForeignKey("FileLibraryId")] - [InverseProperty("MediaFiles")] - public virtual MediaLibrary FileLibrary { get; set; } = null!; - - [ForeignKey("FileModifiedByUserId")] - [InverseProperty("MediaFileFileModifiedByUsers")] - public virtual CmsUser? FileModifiedByUser { get; set; } -} diff --git a/Migration.Tool.KXP/Models/MediaLibrary.cs b/Migration.Tool.KXP/Models/MediaLibrary.cs deleted file mode 100644 index 3bf7f8ea..00000000 --- a/Migration.Tool.KXP/Models/MediaLibrary.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("Media_Library")] -[Index("LibraryName", "LibraryGuid", Name = "IX_Media_Library_LibrarySiteID_LibraryName_LibraryGUID", IsUnique = true)] -public class MediaLibrary -{ - [Key] - [Column("LibraryID")] - public int LibraryId { get; set; } - - [StringLength(250)] - public string LibraryName { get; set; } = null!; - - [StringLength(250)] - public string LibraryDisplayName { get; set; } = null!; - - public string? LibraryDescription { get; set; } - - [StringLength(250)] - public string LibraryFolder { get; set; } = null!; - - public int? LibraryAccess { get; set; } - - [Column("LibraryGUID")] - public Guid? LibraryGuid { get; set; } - - public DateTime? LibraryLastModified { get; set; } - - [InverseProperty("FileLibrary")] - public virtual ICollection MediaFiles { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmAccount.cs b/Migration.Tool.KXP/Models/OmAccount.cs deleted file mode 100644 index 639cdbda..00000000 --- a/Migration.Tool.KXP/Models/OmAccount.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_Account")] -[Index("AccountCountryId", Name = "IX_OM_Account_AccountCountryID")] -[Index("AccountOwnerUserId", Name = "IX_OM_Account_AccountOwnerUserID")] -[Index("AccountPrimaryContactId", Name = "IX_OM_Account_AccountPrimaryContactID")] -[Index("AccountSecondaryContactId", Name = "IX_OM_Account_AccountSecondaryContactID")] -[Index("AccountStateId", Name = "IX_OM_Account_AccountStateID")] -[Index("AccountStatusId", Name = "IX_OM_Account_AccountStatusID")] -[Index("AccountSubsidiaryOfId", Name = "IX_OM_Account_AccountSubsidiaryOfID")] -public class OmAccount -{ - [Key] - [Column("AccountID")] - public int AccountId { get; set; } - - [StringLength(200)] - public string AccountName { get; set; } = null!; - - [StringLength(100)] - public string? AccountAddress1 { get; set; } - - [StringLength(100)] - public string? AccountAddress2 { get; set; } - - [StringLength(100)] - public string? AccountCity { get; set; } - - [Column("AccountZIP")] - [StringLength(20)] - public string? AccountZip { get; set; } - - [Column("AccountStateID")] - public int? AccountStateId { get; set; } - - [Column("AccountCountryID")] - public int? AccountCountryId { get; set; } - - [StringLength(200)] - public string? AccountWebSite { get; set; } - - [StringLength(26)] - public string? AccountPhone { get; set; } - - [StringLength(254)] - public string? AccountEmail { get; set; } - - [StringLength(26)] - public string? AccountFax { get; set; } - - [Column("AccountPrimaryContactID")] - public int? AccountPrimaryContactId { get; set; } - - [Column("AccountSecondaryContactID")] - public int? AccountSecondaryContactId { get; set; } - - [Column("AccountStatusID")] - public int? AccountStatusId { get; set; } - - public string? AccountNotes { get; set; } - - [Column("AccountOwnerUserID")] - public int? AccountOwnerUserId { get; set; } - - [Column("AccountSubsidiaryOfID")] - public int? AccountSubsidiaryOfId { get; set; } - - [Column("AccountGUID")] - public Guid AccountGuid { get; set; } - - public DateTime AccountLastModified { get; set; } - - public DateTime AccountCreated { get; set; } - - [ForeignKey("AccountCountryId")] - [InverseProperty("OmAccounts")] - public virtual CmsCountry? AccountCountry { get; set; } - - [ForeignKey("AccountOwnerUserId")] - [InverseProperty("OmAccounts")] - public virtual CmsUser? AccountOwnerUser { get; set; } - - [ForeignKey("AccountPrimaryContactId")] - [InverseProperty("OmAccountAccountPrimaryContacts")] - public virtual OmContact? AccountPrimaryContact { get; set; } - - [ForeignKey("AccountSecondaryContactId")] - [InverseProperty("OmAccountAccountSecondaryContacts")] - public virtual OmContact? AccountSecondaryContact { get; set; } - - [ForeignKey("AccountStateId")] - [InverseProperty("OmAccounts")] - public virtual CmsState? AccountState { get; set; } - - [ForeignKey("AccountStatusId")] - [InverseProperty("OmAccounts")] - public virtual OmAccountStatus? AccountStatus { get; set; } - - [ForeignKey("AccountSubsidiaryOfId")] - [InverseProperty("InverseAccountSubsidiaryOf")] - public virtual OmAccount? AccountSubsidiaryOf { get; set; } - - [InverseProperty("AccountSubsidiaryOf")] - public virtual ICollection InverseAccountSubsidiaryOf { get; set; } = new List(); - - [InverseProperty("Account")] - public virtual ICollection OmAccountContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmAccountContact.cs b/Migration.Tool.KXP/Models/OmAccountContact.cs deleted file mode 100644 index eb09e5a1..00000000 --- a/Migration.Tool.KXP/Models/OmAccountContact.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_AccountContact")] -[Index("AccountId", Name = "IX_OM_AccountContact_AccountID")] -[Index("ContactId", Name = "IX_OM_AccountContact_ContactID")] -[Index("ContactRoleId", Name = "IX_OM_AccountContact_ContactRoleID")] -public class OmAccountContact -{ - [Key] - [Column("AccountContactID")] - public int AccountContactId { get; set; } - - [Column("ContactRoleID")] - public int? ContactRoleId { get; set; } - - [Column("AccountID")] - public int AccountId { get; set; } - - [Column("ContactID")] - public int ContactId { get; set; } - - [ForeignKey("AccountId")] - [InverseProperty("OmAccountContacts")] - public virtual OmAccount Account { get; set; } = null!; - - [ForeignKey("ContactId")] - [InverseProperty("OmAccountContacts")] - public virtual OmContact Contact { get; set; } = null!; - - [ForeignKey("ContactRoleId")] - [InverseProperty("OmAccountContacts")] - public virtual OmContactRole? ContactRole { get; set; } -} diff --git a/Migration.Tool.KXP/Models/OmAccountStatus.cs b/Migration.Tool.KXP/Models/OmAccountStatus.cs deleted file mode 100644 index 980c03cb..00000000 --- a/Migration.Tool.KXP/Models/OmAccountStatus.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_AccountStatus")] -public class OmAccountStatus -{ - [Key] - [Column("AccountStatusID")] - public int AccountStatusId { get; set; } - - [StringLength(200)] - public string AccountStatusName { get; set; } = null!; - - [StringLength(200)] - public string AccountStatusDisplayName { get; set; } = null!; - - public string? AccountStatusDescription { get; set; } - - [InverseProperty("AccountStatus")] - public virtual ICollection OmAccounts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmActivity.cs b/Migration.Tool.KXP/Models/OmActivity.cs deleted file mode 100644 index adc794ba..00000000 --- a/Migration.Tool.KXP/Models/OmActivity.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_Activity")] -[Index("ActivityChannelId", Name = "IX_OM_Activity_ActivityChannelID")] -[Index("ActivityContactId", Name = "IX_OM_Activity_ActivityContactID")] -[Index("ActivityCreated", Name = "IX_OM_Activity_ActivityCreated")] -[Index("ActivityItemDetailId", Name = "IX_OM_Activity_ActivityItemDetailID")] -[Index("ActivityLanguageId", Name = "IX_OM_Activity_ActivityLanguageID")] -[Index("ActivityType", "ActivityItemId", "ActivityWebPageItemGuid", Name = "IX_OM_Activity_ActivityType_ActivityItemID_ActivityWebPageItemGUID_ActivityUTMSource_ActivityUTMContent")] -public class OmActivity -{ - [Key] - [Column("ActivityID")] - public int ActivityId { get; set; } - - [Column("ActivityContactID")] - public int ActivityContactId { get; set; } - - public DateTime? ActivityCreated { get; set; } - - [StringLength(250)] - public string ActivityType { get; set; } = null!; - - [Column("ActivityItemID")] - public int? ActivityItemId { get; set; } - - [Column("ActivityItemDetailID")] - public int? ActivityItemDetailId { get; set; } - - [StringLength(250)] - public string? ActivityValue { get; set; } - - [Column("ActivityURL")] - public string? ActivityUrl { get; set; } - - [StringLength(250)] - public string? ActivityTitle { get; set; } - - public string? ActivityComment { get; set; } - - [Column("ActivityURLReferrer")] - public string? ActivityUrlreferrer { get; set; } - - [Column("ActivityUTMSource")] - [StringLength(200)] - public string? ActivityUtmsource { get; set; } - - [Column("ActivityUTMContent")] - [StringLength(200)] - public string? ActivityUtmcontent { get; set; } - - [Column("ActivityTrackedWebsiteID")] - public int? ActivityTrackedWebsiteId { get; set; } - - [Column("ActivityWebPageItemGUID")] - public Guid? ActivityWebPageItemGuid { get; set; } - - [Column("ActivityLanguageID")] - public int? ActivityLanguageId { get; set; } - - [Column("ActivityChannelID")] - public int? ActivityChannelId { get; set; } - - [ForeignKey("ActivityChannelId")] - [InverseProperty("OmActivities")] - public virtual CmsChannel? ActivityChannel { get; set; } - - [ForeignKey("ActivityLanguageId")] - [InverseProperty("OmActivities")] - public virtual CmsContentLanguage? ActivityLanguage { get; set; } -} diff --git a/Migration.Tool.KXP/Models/OmActivityRecalculationQueue.cs b/Migration.Tool.KXP/Models/OmActivityRecalculationQueue.cs deleted file mode 100644 index f3244a05..00000000 --- a/Migration.Tool.KXP/Models/OmActivityRecalculationQueue.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ActivityRecalculationQueue")] -public class OmActivityRecalculationQueue -{ - [Key] - [Column("ActivityRecalculationQueueID")] - public int ActivityRecalculationQueueId { get; set; } - - [Column("ActivityRecalculationQueueActivityID")] - public int ActivityRecalculationQueueActivityId { get; set; } -} diff --git a/Migration.Tool.KXP/Models/OmActivityType.cs b/Migration.Tool.KXP/Models/OmActivityType.cs deleted file mode 100644 index 48b856a0..00000000 --- a/Migration.Tool.KXP/Models/OmActivityType.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ActivityType")] -public class OmActivityType -{ - [Key] - [Column("ActivityTypeID")] - public int ActivityTypeId { get; set; } - - [StringLength(250)] - public string ActivityTypeDisplayName { get; set; } = null!; - - [StringLength(250)] - public string ActivityTypeName { get; set; } = null!; - - public bool? ActivityTypeEnabled { get; set; } - - public bool? ActivityTypeIsCustom { get; set; } - - public string? ActivityTypeDescription { get; set; } - - public bool? ActivityTypeManualCreationAllowed { get; set; } - - [StringLength(200)] - public string? ActivityTypeMainFormControl { get; set; } - - [StringLength(200)] - public string? ActivityTypeDetailFormControl { get; set; } - - [StringLength(7)] - public string? ActivityTypeColor { get; set; } - - [StringLength(200)] - public string? ActivityTypeItemObjectType { get; set; } - - [StringLength(200)] - public string? ActivityTypeItemDetailObjectType { get; set; } -} diff --git a/Migration.Tool.KXP/Models/OmContact.cs b/Migration.Tool.KXP/Models/OmContact.cs deleted file mode 100644 index e0b6ef9a..00000000 --- a/Migration.Tool.KXP/Models/OmContact.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_Contact")] -[Index("ContactCountryId", Name = "IX_OM_Contact_ContactCountryID")] -[Index("ContactEmail", Name = "IX_OM_Contact_ContactEmail")] -[Index("ContactGuid", Name = "IX_OM_Contact_ContactGUID", IsUnique = true)] -[Index("ContactLastName", Name = "IX_OM_Contact_ContactLastName")] -[Index("ContactOwnerUserId", Name = "IX_OM_Contact_ContactOwnerUserID")] -[Index("ContactStateId", Name = "IX_OM_Contact_ContactStateID")] -[Index("ContactStatusId", Name = "IX_OM_Contact_ContactStatusID")] -public class OmContact -{ - [Key] - [Column("ContactID")] - public int ContactId { get; set; } - - [StringLength(100)] - public string? ContactFirstName { get; set; } - - [StringLength(100)] - public string? ContactMiddleName { get; set; } - - [StringLength(100)] - public string? ContactLastName { get; set; } - - [StringLength(50)] - public string? ContactJobTitle { get; set; } - - [StringLength(100)] - public string? ContactAddress1 { get; set; } - - [StringLength(100)] - public string? ContactCity { get; set; } - - [Column("ContactZIP")] - [StringLength(100)] - public string? ContactZip { get; set; } - - [Column("ContactStateID")] - public int? ContactStateId { get; set; } - - [Column("ContactCountryID")] - public int? ContactCountryId { get; set; } - - [StringLength(26)] - public string? ContactMobilePhone { get; set; } - - [StringLength(26)] - public string? ContactBusinessPhone { get; set; } - - [StringLength(254)] - public string? ContactEmail { get; set; } - - public DateTime? ContactBirthday { get; set; } - - public int? ContactGender { get; set; } - - [Column("ContactStatusID")] - public int? ContactStatusId { get; set; } - - public string? ContactNotes { get; set; } - - [Column("ContactOwnerUserID")] - public int? ContactOwnerUserId { get; set; } - - public bool? ContactMonitored { get; set; } - - [Column("ContactGUID")] - public Guid ContactGuid { get; set; } - - public DateTime ContactLastModified { get; set; } - - public DateTime ContactCreated { get; set; } - - public int? ContactBounces { get; set; } - - [StringLength(200)] - public string? ContactCampaign { get; set; } - - [Column("ContactSalesForceLeadID")] - [StringLength(18)] - public string? ContactSalesForceLeadId { get; set; } - - public bool? ContactSalesForceLeadReplicationDisabled { get; set; } - - public DateTime? ContactSalesForceLeadReplicationDateTime { get; set; } - - public DateTime? ContactSalesForceLeadReplicationSuspensionDateTime { get; set; } - - [StringLength(100)] - public string? ContactCompanyName { get; set; } - - public bool? ContactSalesForceLeadReplicationRequired { get; set; } - - [InverseProperty("ConsentAgreementContact")] - public virtual ICollection CmsConsentAgreements { get; set; } = new List(); - - [ForeignKey("ContactCountryId")] - [InverseProperty("OmContacts")] - public virtual CmsCountry? ContactCountry { get; set; } - - [ForeignKey("ContactOwnerUserId")] - [InverseProperty("OmContacts")] - public virtual CmsUser? ContactOwnerUser { get; set; } - - [ForeignKey("ContactStateId")] - [InverseProperty("OmContacts")] - public virtual CmsState? ContactState { get; set; } - - [ForeignKey("ContactStatusId")] - [InverseProperty("OmContacts")] - public virtual OmContactStatus? ContactStatus { get; set; } - - [InverseProperty("EmailMarketingRecipientContact")] - public virtual ICollection EmailLibraryEmailMarketingRecipients { get; set; } = new List(); - - [InverseProperty("EmailSubscriptionConfirmationContact")] - public virtual ICollection EmailLibraryEmailSubscriptionConfirmations { get; set; } = new List(); - - [InverseProperty("AccountPrimaryContact")] - public virtual ICollection OmAccountAccountPrimaryContacts { get; set; } = new List(); - - [InverseProperty("AccountSecondaryContact")] - public virtual ICollection OmAccountAccountSecondaryContacts { get; set; } = new List(); - - [InverseProperty("Contact")] - public virtual ICollection OmAccountContacts { get; set; } = new List(); - - [InverseProperty("VisitorToContactContact")] - public virtual ICollection OmVisitorToContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmContactChangeRecalculationQueue.cs b/Migration.Tool.KXP/Models/OmContactChangeRecalculationQueue.cs deleted file mode 100644 index 17762fe9..00000000 --- a/Migration.Tool.KXP/Models/OmContactChangeRecalculationQueue.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ContactChangeRecalculationQueue")] -public class OmContactChangeRecalculationQueue -{ - [Key] - [Column("ContactChangeRecalculationQueueID")] - public int ContactChangeRecalculationQueueId { get; set; } - - [Column("ContactChangeRecalculationQueueContactID")] - public int ContactChangeRecalculationQueueContactId { get; set; } - - public string? ContactChangeRecalculationQueueChangedColumns { get; set; } - - public bool ContactChangeRecalculationQueueContactIsNew { get; set; } - - public bool ContactChangeRecalculationQueueContactWasMerged { get; set; } -} diff --git a/Migration.Tool.KXP/Models/OmContactGroup.cs b/Migration.Tool.KXP/Models/OmContactGroup.cs deleted file mode 100644 index f4615078..00000000 --- a/Migration.Tool.KXP/Models/OmContactGroup.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ContactGroup")] -public class OmContactGroup -{ - [Key] - [Column("ContactGroupID")] - public int ContactGroupId { get; set; } - - [StringLength(200)] - public string ContactGroupName { get; set; } = null!; - - [StringLength(200)] - public string ContactGroupDisplayName { get; set; } = null!; - - public string? ContactGroupDescription { get; set; } - - public string? ContactGroupDynamicCondition { get; set; } - - public bool? ContactGroupEnabled { get; set; } - - public DateTime? ContactGroupLastModified { get; set; } - - [Column("ContactGroupGUID")] - public Guid? ContactGroupGuid { get; set; } - - public int? ContactGroupStatus { get; set; } - - public bool? ContactGroupIsRecipientList { get; set; } - - [InverseProperty("EmailSubscriptionConfirmationRecipientList")] - public virtual ICollection EmailLibraryEmailSubscriptionConfirmations { get; set; } = new List(); - - [InverseProperty("RecipientListSettingsRecipientList")] - public virtual ICollection EmailLibraryRecipientListSettings { get; set; } = new List(); - - [InverseProperty("SendConfigurationRecipientList")] - public virtual ICollection EmailLibrarySendConfigurations { get; set; } = new List(); - - [InverseProperty("ContactGroupMemberContactGroup")] - public virtual ICollection OmContactGroupMembers { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmContactGroupMember.cs b/Migration.Tool.KXP/Models/OmContactGroupMember.cs deleted file mode 100644 index fecb7014..00000000 --- a/Migration.Tool.KXP/Models/OmContactGroupMember.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ContactGroupMember")] -[Index("ContactGroupMemberContactGroupId", "ContactGroupMemberType", Name = "IX_OM_ContactGroupMember_ContactGroupID_Type_MemberID_RelatedID_FromCondition_FromAccount_FromManual")] -[Index("ContactGroupMemberContactGroupId", "ContactGroupMemberType", "ContactGroupMemberRelatedId", Name = "IX_OM_ContactGroupMember_ContactGroupID_Type_RelatedID", IsUnique = true)] -[Index("ContactGroupMemberRelatedId", Name = "IX_OM_ContactGroupMember_ContactGroupMemberRelatedID")] -public class OmContactGroupMember -{ - [Key] - [Column("ContactGroupMemberID")] - public int ContactGroupMemberId { get; set; } - - [Column("ContactGroupMemberContactGroupID")] - public int ContactGroupMemberContactGroupId { get; set; } - - public int ContactGroupMemberType { get; set; } - - [Column("ContactGroupMemberRelatedID")] - public int ContactGroupMemberRelatedId { get; set; } - - public bool? ContactGroupMemberFromCondition { get; set; } - - public bool? ContactGroupMemberFromAccount { get; set; } - - public bool? ContactGroupMemberFromManual { get; set; } - - [ForeignKey("ContactGroupMemberContactGroupId")] - [InverseProperty("OmContactGroupMembers")] - public virtual OmContactGroup ContactGroupMemberContactGroup { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/OmContactRole.cs b/Migration.Tool.KXP/Models/OmContactRole.cs deleted file mode 100644 index 444bf94e..00000000 --- a/Migration.Tool.KXP/Models/OmContactRole.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ContactRole")] -public class OmContactRole -{ - [Key] - [Column("ContactRoleID")] - public int ContactRoleId { get; set; } - - [StringLength(200)] - public string ContactRoleName { get; set; } = null!; - - [StringLength(200)] - public string ContactRoleDisplayName { get; set; } = null!; - - public string? ContactRoleDescription { get; set; } - - [InverseProperty("ContactRole")] - public virtual ICollection OmAccountContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmContactStatus.cs b/Migration.Tool.KXP/Models/OmContactStatus.cs deleted file mode 100644 index 24406a83..00000000 --- a/Migration.Tool.KXP/Models/OmContactStatus.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_ContactStatus")] -public class OmContactStatus -{ - [Key] - [Column("ContactStatusID")] - public int ContactStatusId { get; set; } - - [StringLength(200)] - public string ContactStatusName { get; set; } = null!; - - [StringLength(200)] - public string ContactStatusDisplayName { get; set; } = null!; - - public string? ContactStatusDescription { get; set; } - - [InverseProperty("ContactStatus")] - public virtual ICollection OmContacts { get; set; } = new List(); -} diff --git a/Migration.Tool.KXP/Models/OmTrackedWebsite.cs b/Migration.Tool.KXP/Models/OmTrackedWebsite.cs deleted file mode 100644 index ff279e4a..00000000 --- a/Migration.Tool.KXP/Models/OmTrackedWebsite.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_TrackedWebsite")] -public class OmTrackedWebsite -{ - [Key] - [Column("TrackedWebsiteID")] - public int TrackedWebsiteId { get; set; } - - [Column("TrackedWebsiteGUID")] - public Guid? TrackedWebsiteGuid { get; set; } - - [StringLength(200)] - public string TrackedWebsiteDisplayName { get; set; } = null!; - - [StringLength(100)] - public string TrackedWebsiteName { get; set; } = null!; - - [Column("TrackedWebsiteURL")] - [StringLength(400)] - public string TrackedWebsiteUrl { get; set; } = null!; - - public string? TrackedWebsiteDescription { get; set; } - - public bool? TrackedWebsiteEnabled { get; set; } - - public DateTime? TrackedWebsiteLastModified { get; set; } - - [Column("TrackedWebsiteChannelID")] - public int TrackedWebsiteChannelId { get; set; } -} diff --git a/Migration.Tool.KXP/Models/OmVisitorToContact.cs b/Migration.Tool.KXP/Models/OmVisitorToContact.cs deleted file mode 100644 index 7e809c68..00000000 --- a/Migration.Tool.KXP/Models/OmVisitorToContact.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Table("OM_VisitorToContact")] -[Index("VisitorToContactContactId", Name = "IX_OM_VisitorToContact_VisitorToContactContactID")] -[Index("VisitorToContactVisitorGuid", Name = "IX_OM_VisitorToContact_VisitorToContactVisitorGUID", IsUnique = true)] -public class OmVisitorToContact -{ - [Key] - [Column("VisitorToContactID")] - public int VisitorToContactId { get; set; } - - [Column("VisitorToContactVisitorGUID")] - public Guid VisitorToContactVisitorGuid { get; set; } - - [Column("VisitorToContactContactID")] - public int VisitorToContactContactId { get; set; } - - [ForeignKey("VisitorToContactContactId")] - [InverseProperty("OmVisitorToContacts")] - public virtual OmContact VisitorToContactContact { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/TempFile.cs b/Migration.Tool.KXP/Models/TempFile.cs deleted file mode 100644 index 3ad61a60..00000000 --- a/Migration.Tool.KXP/Models/TempFile.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("Temp_File")] -public class TempFile -{ - [Key] - [Column("FileID")] - public int FileId { get; set; } - - [Column("FileParentGUID")] - public Guid FileParentGuid { get; set; } - - public int FileNumber { get; set; } - - [StringLength(50)] - public string FileExtension { get; set; } = null!; - - public long FileSize { get; set; } - - [StringLength(100)] - public string FileMimeType { get; set; } = null!; - - public int? FileImageWidth { get; set; } - - public int? FileImageHeight { get; set; } - - public byte[]? FileBinary { get; set; } - - [Column("FileGUID")] - public Guid FileGuid { get; set; } - - public DateTime FileLastModified { get; set; } - - [StringLength(200)] - public string FileDirectory { get; set; } = null!; - - [StringLength(200)] - public string FileName { get; set; } = null!; - - [StringLength(250)] - public string? FileTitle { get; set; } - - public string? FileDescription { get; set; } -} diff --git a/Migration.Tool.KXP/Models/TempPageBuilderWidget.cs b/Migration.Tool.KXP/Models/TempPageBuilderWidget.cs deleted file mode 100644 index cbcad9b2..00000000 --- a/Migration.Tool.KXP/Models/TempPageBuilderWidget.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Migration.Tool.KXP.Models; - -[Table("Temp_PageBuilderWidgets")] -public class TempPageBuilderWidget -{ - [Key] - [Column("PageBuilderWidgetsID")] - public int PageBuilderWidgetsId { get; set; } - - public string? PageBuilderWidgetsConfiguration { get; set; } - - public Guid PageBuilderWidgetsGuid { get; set; } - - public DateTime PageBuilderWidgetsLastModified { get; set; } - - public string? PageBuilderTemplateConfiguration { get; set; } -} diff --git a/Migration.Tool.KXP/Models/ViewCmsResourceStringJoined.cs b/Migration.Tool.KXP/Models/ViewCmsResourceStringJoined.cs deleted file mode 100644 index 5e4b4ca3..00000000 --- a/Migration.Tool.KXP/Models/ViewCmsResourceStringJoined.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Keyless] -public class ViewCmsResourceStringJoined -{ - [Column("StringID")] - public int StringId { get; set; } - - [StringLength(200)] - public string StringKey { get; set; } = null!; - - public bool StringIsCustom { get; set; } - - [Column("TranslationID")] - public int? TranslationId { get; set; } - - [Column("TranslationStringID")] - public int? TranslationStringId { get; set; } - - [Column("TranslationCultureID")] - public int? TranslationCultureId { get; set; } - - public string? TranslationText { get; set; } - - [Column("CultureID")] - public int? CultureId { get; set; } - - [StringLength(200)] - public string? CultureName { get; set; } - - [StringLength(50)] - public string? CultureCode { get; set; } - - [Column("CultureGUID")] - public Guid? CultureGuid { get; set; } - - public DateTime? CultureLastModified { get; set; } -} diff --git a/Migration.Tool.KXP/Models/ViewCmsResourceTranslatedJoined.cs b/Migration.Tool.KXP/Models/ViewCmsResourceTranslatedJoined.cs deleted file mode 100644 index 7368bcf1..00000000 --- a/Migration.Tool.KXP/Models/ViewCmsResourceTranslatedJoined.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Keyless] -public class ViewCmsResourceTranslatedJoined -{ - [Column("StringID")] - public int StringId { get; set; } - - [StringLength(200)] - public string StringKey { get; set; } = null!; - - public string? TranslationText { get; set; } - - [Column("CultureID")] - public int CultureId { get; set; } - - [StringLength(200)] - public string CultureName { get; set; } = null!; - - [StringLength(50)] - public string CultureCode { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/ViewOmAccountContactAccountJoined.cs b/Migration.Tool.KXP/Models/ViewOmAccountContactAccountJoined.cs deleted file mode 100644 index 04316806..00000000 --- a/Migration.Tool.KXP/Models/ViewOmAccountContactAccountJoined.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Keyless] -public class ViewOmAccountContactAccountJoined -{ - [Column("AccountID")] - public int AccountId { get; set; } - - [StringLength(200)] - public string AccountName { get; set; } = null!; - - [Column("ContactID")] - public int ContactId { get; set; } - - [Column("AccountContactID")] - public int AccountContactId { get; set; } - - [Column("ContactRoleID")] - public int? ContactRoleId { get; set; } - - [Column("AccountCountryID")] - public int? AccountCountryId { get; set; } - - [Column("AccountStatusID")] - public int? AccountStatusId { get; set; } -} diff --git a/Migration.Tool.KXP/Models/ViewOmAccountContactContactJoined.cs b/Migration.Tool.KXP/Models/ViewOmAccountContactContactJoined.cs deleted file mode 100644 index 2dd123a4..00000000 --- a/Migration.Tool.KXP/Models/ViewOmAccountContactContactJoined.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Keyless] -public class ViewOmAccountContactContactJoined -{ - [Column("ContactID")] - public int ContactId { get; set; } - - [StringLength(100)] - public string? ContactFirstName { get; set; } - - [StringLength(100)] - public string? ContactMiddleName { get; set; } - - [StringLength(100)] - public string? ContactLastName { get; set; } - - [StringLength(254)] - public string? ContactEmail { get; set; } - - [Column("AccountID")] - public int AccountId { get; set; } - - [Column("AccountContactID")] - public int AccountContactId { get; set; } - - [Column("ContactCountryID")] - public int? ContactCountryId { get; set; } - - [Column("ContactStatusID")] - public int? ContactStatusId { get; set; } - - [Column("ContactRoleID")] - public int? ContactRoleId { get; set; } -} diff --git a/Migration.Tool.KXP/Models/ViewOmAccountJoined.cs b/Migration.Tool.KXP/Models/ViewOmAccountJoined.cs deleted file mode 100644 index b4a6e9a3..00000000 --- a/Migration.Tool.KXP/Models/ViewOmAccountJoined.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Keyless] -public class ViewOmAccountJoined -{ - [Column("AccountID")] - public int AccountId { get; set; } - - [StringLength(200)] - public string AccountName { get; set; } = null!; - - [StringLength(100)] - public string? AccountAddress1 { get; set; } - - [StringLength(100)] - public string? AccountAddress2 { get; set; } - - [StringLength(100)] - public string? AccountCity { get; set; } - - [Column("AccountZIP")] - [StringLength(20)] - public string? AccountZip { get; set; } - - [Column("AccountStateID")] - public int? AccountStateId { get; set; } - - [Column("AccountCountryID")] - public int? AccountCountryId { get; set; } - - [StringLength(200)] - public string? AccountWebSite { get; set; } - - [StringLength(26)] - public string? AccountPhone { get; set; } - - [StringLength(254)] - public string? AccountEmail { get; set; } - - [StringLength(26)] - public string? AccountFax { get; set; } - - [Column("AccountPrimaryContactID")] - public int? AccountPrimaryContactId { get; set; } - - [Column("AccountSecondaryContactID")] - public int? AccountSecondaryContactId { get; set; } - - [Column("AccountStatusID")] - public int? AccountStatusId { get; set; } - - public string? AccountNotes { get; set; } - - [Column("AccountOwnerUserID")] - public int? AccountOwnerUserId { get; set; } - - [Column("AccountSubsidiaryOfID")] - public int? AccountSubsidiaryOfId { get; set; } - - [Column("AccountGUID")] - public Guid AccountGuid { get; set; } - - public DateTime AccountLastModified { get; set; } - - public DateTime AccountCreated { get; set; } - - [StringLength(100)] - public string? PrimaryContactFirstName { get; set; } - - [StringLength(100)] - public string? PrimaryContactMiddleName { get; set; } - - [StringLength(100)] - public string? PrimaryContactLastName { get; set; } - - [StringLength(100)] - public string? SecondaryContactFirstName { get; set; } - - [StringLength(100)] - public string? SecondaryContactMiddleName { get; set; } - - [StringLength(100)] - public string? SecondaryContactLastName { get; set; } - - [StringLength(200)] - public string? SubsidiaryOfName { get; set; } - - [StringLength(302)] - public string PrimaryContactFullName { get; set; } = null!; - - [StringLength(302)] - public string SecondaryContactFullName { get; set; } = null!; - - [StringLength(201)] - public string AccountFullAddress { get; set; } = null!; -} diff --git a/Migration.Tool.KXP/Models/ViewOmContactGroupMemberAccountJoined.cs b/Migration.Tool.KXP/Models/ViewOmContactGroupMemberAccountJoined.cs deleted file mode 100644 index 0e9aa49c..00000000 --- a/Migration.Tool.KXP/Models/ViewOmContactGroupMemberAccountJoined.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -using Microsoft.EntityFrameworkCore; - -namespace Migration.Tool.KXP.Models; - -[Keyless] -public class ViewOmContactGroupMemberAccountJoined -{ - [Column("AccountID")] - public int AccountId { get; set; } - - [StringLength(200)] - public string AccountName { get; set; } = null!; - - [StringLength(100)] - public string? AccountAddress1 { get; set; } - - [StringLength(100)] - public string? AccountAddress2 { get; set; } - - [StringLength(100)] - public string? AccountCity { get; set; } - - [Column("AccountZIP")] - [StringLength(20)] - public string? AccountZip { get; set; } - - [Column("AccountStateID")] - public int? AccountStateId { get; set; } - - [Column("AccountCountryID")] - public int? AccountCountryId { get; set; } - - [StringLength(200)] - public string? AccountWebSite { get; set; } - - [StringLength(26)] - public string? AccountPhone { get; set; } - - [StringLength(254)] - public string? AccountEmail { get; set; } - - [StringLength(26)] - public string? AccountFax { get; set; } - - [Column("AccountPrimaryContactID")] - public int? AccountPrimaryContactId { get; set; } - - [Column("AccountSecondaryContactID")] - public int? AccountSecondaryContactId { get; set; } - - [Column("AccountStatusID")] - public int? AccountStatusId { get; set; } - - public string? AccountNotes { get; set; } - - [Column("AccountOwnerUserID")] - public int? AccountOwnerUserId { get; set; } - - [Column("AccountSubsidiaryOfID")] - public int? AccountSubsidiaryOfId { get; set; } - - [Column("AccountGUID")] - public Guid AccountGuid { get; set; } - - public DateTime AccountLastModified { get; set; } - - public DateTime AccountCreated { get; set; } - - [Column("ContactGroupMemberContactGroupID")] - public int ContactGroupMemberContactGroupId { get; set; } - - [Column("ContactGroupMemberID")] - public int ContactGroupMemberId { get; set; } -} diff --git a/Migration.Tool.KXP/genModel.ps1 b/Migration.Tool.KXP/genModel.ps1 deleted file mode 100644 index f6fe396d..00000000 --- a/Migration.Tool.KXP/genModel.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -param([string]$connection) -dotnet ef dbcontext scaffold $connection Microsoft.EntityFrameworkCore.SqlServer --output-dir Models --context-dir Context --context KxpContext --data-annotations --force # --use-database-names - -# Remove connection string -#$workDir = $MyInvocation.MyCommand.Path -#$workDir = [System.IO.Path]::GetDirectoryName($workDir) -#$contextPath = "$workDir\Context\KxpContext.cs" -#$contextText = [System.IO.File]::ReadAllText($contextPath) -#$result = $contextText -replace '(?i-mn).*if \(\!optionsBuilder\.IsConfigured\)[\s\S]*?\}',''; -#$result = $result -replace '(?i-mn).*protected override void OnConfiguring[\s\S]*?\}',''; -#[System.IO.File]::WriteAllText($contextPath, $result) - -# ./genModel.ps1 -connection "Data Source=.;Initial Catalog=XK28_4_1_BP;Integrated Security=True;Persist Security Info=False;Connect Timeout=60;Encrypt=False;Current Language=English;" \ No newline at end of file diff --git a/Migration.Tool.sln b/Migration.Tool.sln index 658e8b74..5acc2cd9 100644 --- a/Migration.Tool.sln +++ b/Migration.Tool.sln @@ -6,8 +6,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migration.Tool.CLI", "Migra EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migration.Tool.KX13", "Migration.Tool.KX13\Migration.Tool.KX13.csproj", "{C834C407-683B-4251-A4CD-52C135DCA518}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migration.Tool.KXP", "Migration.Tool.KXP\Migration.Tool.KXP.csproj", "{5F3DCE58-E1ED-4190-B3DA-610AA4F166A0}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migration.Tool.Common", "Migration.Tool.Common\Migration.Tool.Common.csproj", "{CE8ED7D2-DA7B-4106-BADA-A70E2DFCCAAF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migration.Tool.Core.KX13", "Migration.Tool.Core.KX13\Migration.Tool.Core.KX13.csproj", "{1F7DC18B-CF87-4AB2-A5CC-094125246954}" @@ -58,10 +56,6 @@ Global {C834C407-683B-4251-A4CD-52C135DCA518}.Debug|Any CPU.Build.0 = Debug|Any CPU {C834C407-683B-4251-A4CD-52C135DCA518}.Release|Any CPU.ActiveCfg = Release|Any CPU {C834C407-683B-4251-A4CD-52C135DCA518}.Release|Any CPU.Build.0 = Release|Any CPU - {5F3DCE58-E1ED-4190-B3DA-610AA4F166A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F3DCE58-E1ED-4190-B3DA-610AA4F166A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F3DCE58-E1ED-4190-B3DA-610AA4F166A0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F3DCE58-E1ED-4190-B3DA-610AA4F166A0}.Release|Any CPU.Build.0 = Release|Any CPU {CE8ED7D2-DA7B-4106-BADA-A70E2DFCCAAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE8ED7D2-DA7B-4106-BADA-A70E2DFCCAAF}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE8ED7D2-DA7B-4106-BADA-A70E2DFCCAAF}.Release|Any CPU.ActiveCfg = Release|Any CPU From 304046a0a08e1494cdfe786964a2a1588362c7f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Krch?= Date: Tue, 19 Nov 2024 00:56:12 +0100 Subject: [PATCH 10/10] removal of Migration.Tool.KXP project from project refs --- Migration.Tool.CLI/Migration.Tool.CLI.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Migration.Tool.CLI/Migration.Tool.CLI.csproj b/Migration.Tool.CLI/Migration.Tool.CLI.csproj index 78fcfefa..a2f9f634 100644 --- a/Migration.Tool.CLI/Migration.Tool.CLI.csproj +++ b/Migration.Tool.CLI/Migration.Tool.CLI.csproj @@ -14,8 +14,7 @@ - - +