diff --git a/configuration.json b/configuration.json
index b7b5dd9f9..1edc0c355 100644
--- a/configuration.json
+++ b/configuration.json
@@ -56,6 +56,12 @@
"ReplayRevisions": true,
"MaxRevisions": 0
},
+ {
+ "$type": "TfsAttachmentEnricherOptions",
+ "Enabled": true,
+ "ExportBasePath": "c:\\temp\\WorkItemAttachmentExport",
+ "MaxRevisions": 480000000
+ },
{
"$type": "StringManipulatorEnricherOptions",
"Enabled": true,
diff --git a/src/MigrationTools.Clients.AzureDevops.ObjectModel/ProcessorEnrichers/TfsAttachmentEnricherOptions.cs b/src/MigrationTools.Clients.AzureDevops.ObjectModel/ProcessorEnrichers/TfsAttachmentEnricherOptions.cs
index f183aa43d..0b99935d4 100644
--- a/src/MigrationTools.Clients.AzureDevops.ObjectModel/ProcessorEnrichers/TfsAttachmentEnricherOptions.cs
+++ b/src/MigrationTools.Clients.AzureDevops.ObjectModel/ProcessorEnrichers/TfsAttachmentEnricherOptions.cs
@@ -22,13 +22,13 @@ public class TfsAttachmentEnricherOptions : ProcessorEnricherOptions, ITfsAttach
/// For Azure DevOps Services the default is 480,000,000 bites (60mb), for TFS its 32,000,000 bites (4mb).
///
/// 480000000
- public string MaxAttachmentSize { get; set; }
+ public int MaxAttachmentSize { get; set; }
public override void SetDefaults()
{
Enabled = true;
ExportBasePath = @"c:\temp\WorkItemAttachmentExport";
- MaxAttachmentSize = "480000000";
+ MaxAttachmentSize = 480000000;
}
static public TfsAttachmentEnricherOptions GetDefaults()
@@ -42,7 +42,7 @@ static public TfsAttachmentEnricherOptions GetDefaults()
public interface ITfsAttachmentEnricherOptions
{
public string ExportBasePath { get; set; }
- public string MaxAttachmentSize { get; set; }
+ public int MaxAttachmentSize { get; set; }
}
}
\ No newline at end of file
diff --git a/src/MigrationTools.Clients.AzureDevops.ObjectModel/ServiceCollectionExtensions.cs b/src/MigrationTools.Clients.AzureDevops.ObjectModel/ServiceCollectionExtensions.cs
index 6415887a2..bb3ebc6be 100644
--- a/src/MigrationTools.Clients.AzureDevops.ObjectModel/ServiceCollectionExtensions.cs
+++ b/src/MigrationTools.Clients.AzureDevops.ObjectModel/ServiceCollectionExtensions.cs
@@ -26,6 +26,7 @@ public static void AddMigrationToolServicesForClientAzureDevOpsObjectModel(this
context.AddTransient();
// Enrichers
+ context.AddSingleton();
context.AddSingleton();
context.AddSingleton();
context.AddSingleton();
diff --git a/src/MigrationTools/_EngineV1/Processors/MigrationProcessorBase.cs b/src/MigrationTools/_EngineV1/Processors/MigrationProcessorBase.cs
index 7598dc224..ee66b687e 100644
--- a/src/MigrationTools/_EngineV1/Processors/MigrationProcessorBase.cs
+++ b/src/MigrationTools/_EngineV1/Processors/MigrationProcessorBase.cs
@@ -100,7 +100,7 @@ protected void PullCommonEnrichersConfig (List _ignore;
private ILogger contextLog;
- private TfsAttachmentEnricher attachmentEnricher;
+ private TfsAttachmentEnricher _attachmentEnricher;
private IWorkItemProcessorEnricher embededImagesEnricher;
private IWorkItemProcessorEnricher _workItemEmbededLinkEnricher;
private StringManipulatorEnricher _stringManipulatorEnricher;
@@ -80,6 +80,7 @@ public WorkItemMigrationContext(IMigrationEngine engine,
IServiceProvider services,
ITelemetryLogger telemetry,
ILogger logger,
+ TfsAttachmentEnricher attachmentEnricher,
TfsNodeStructure nodeStructureEnricher,
TfsRevisionManager revisionManager,
TfsWorkItemLinkEnricher workItemLinkEnricher,
@@ -92,6 +93,7 @@ public WorkItemMigrationContext(IMigrationEngine engine,
_telemetry = telemetry;
_engineConfig = engineConfig.Value;
contextLog = Serilog.Log.ForContext();
+ _attachmentEnricher = attachmentEnricher;
_nodeStructureEnricher = nodeStructureEnricher;
_revisionManager = revisionManager;
_workItemLinkEnricher = workItemLinkEnricher;
@@ -121,7 +123,7 @@ private void ImportCommonEnricherConfigs()
PullCommonEnrichersConfig(_engineConfig.CommonEnrichersConfig, _revisionManager);
PullCommonEnrichersConfig(_engineConfig.CommonEnrichersConfig, _workItemLinkEnricher);
PullCommonEnrichersConfig(_engineConfig.CommonEnrichersConfig, _stringManipulatorEnricher);
- PullCommonEnrichersConfig(_engineConfig.CommonEnrichersConfig, attachmentEnricher);
+ PullCommonEnrichersConfig(_engineConfig.CommonEnrichersConfig, _attachmentEnricher);
}
internal void TraceWriteLine(LogEventLevel level, string message, Dictionary properties = null)
@@ -673,10 +675,10 @@ private async Task ProcessWorkItemAsync(WorkItemData sourceWorkItem, int retryLi
private void ProcessWorkItemAttachments(WorkItemData sourceWorkItem, WorkItemData targetWorkItem, bool save = true)
{
- if (targetWorkItem != null && attachmentEnricher.Options.Enabled && sourceWorkItem.ToWorkItem().Attachments.Count > 0)
+ if (targetWorkItem != null && _attachmentEnricher.Options.Enabled && sourceWorkItem.ToWorkItem().Attachments.Count > 0)
{
- TraceWriteLine(LogEventLevel.Information, "Attachemnts {SourceWorkItemAttachmentCount} | LinkMigrator:{AttachmentMigration}", new Dictionary() { { "SourceWorkItemAttachmentCount", sourceWorkItem.ToWorkItem().Attachments.Count }, { "AttachmentMigration", attachmentEnricher.Options.Enabled } });
- attachmentEnricher.ProcessAttachemnts(sourceWorkItem, targetWorkItem, save);
+ TraceWriteLine(LogEventLevel.Information, "Attachemnts {SourceWorkItemAttachmentCount} | LinkMigrator:{AttachmentMigration}", new Dictionary() { { "SourceWorkItemAttachmentCount", sourceWorkItem.ToWorkItem().Attachments.Count }, { "AttachmentMigration", _attachmentEnricher.Options.Enabled } });
+ _attachmentEnricher.ProcessAttachemnts(sourceWorkItem, targetWorkItem, save);
AddMetric("Attachments", processWorkItemMetrics, targetWorkItem.ToWorkItem().AttachedFileCount);
}
}
@@ -881,7 +883,7 @@ private WorkItemData ReplayRevisions(List revisionsToMigrate, Work
}
targetWorkItem.SaveToAzureDevOps();
- attachmentEnricher.CleanUpAfterSave();
+ _attachmentEnricher.CleanUpAfterSave();
TraceWriteLine(LogEventLevel.Information, "...Saved as {TargetWorkItemId}", new Dictionary { { "TargetWorkItemId", targetWorkItem.Id } });
}
}