diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d65295333..a9e1a10554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - Build on and target .Net 9 rather than 8 +- Fix issue with MEF constructing Remote Table Attachers ## [8.4.1] - 2024-12-10 diff --git a/Rdmp.Core.Tests/DataLoad/Modules/Attachers/AttacherMEFTest.cs b/Rdmp.Core.Tests/DataLoad/Modules/Attachers/AttacherMEFTest.cs new file mode 100644 index 0000000000..c85967c52c --- /dev/null +++ b/Rdmp.Core.Tests/DataLoad/Modules/Attachers/AttacherMEFTest.cs @@ -0,0 +1,32 @@ +using NPOI.SS.Formula.Functions; +using NUnit.Framework; +using Rdmp.Core.DataLoad.Engine.Attachers; +using Rdmp.Core.DataLoad.Modules.Attachers; +using Rdmp.Core.Repositories; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tests.Common; + +namespace Rdmp.Core.Tests.DataLoad.Modules.Attachers +{ + public class AttacherMEFTest: UnitTests + { + + [Test] + public void AttacherMEFCreationTest() + { + var types = MEF.GetTypes().Where(t => !typeof(RemoteAttacher).IsAssignableTo(t)).ToArray(); + List AttacherPaths = types.Select(t => t.FullName).ToList(); + foreach (var path in AttacherPaths) + { + Assert.DoesNotThrow(() => + { + MEF.CreateA(path); + }); + } + } + } +} diff --git a/Rdmp.Core/DataLoad/Engine/Attachers/Attacher.cs b/Rdmp.Core/DataLoad/Engine/Attachers/Attacher.cs index 1c30e2ea46..60d97abf64 100644 --- a/Rdmp.Core/DataLoad/Engine/Attachers/Attacher.cs +++ b/Rdmp.Core/DataLoad/Engine/Attachers/Attacher.cs @@ -64,6 +64,11 @@ protected Attacher(bool requestsExternalDatabaseCreation) RequestsExternalDatabaseCreation = requestsExternalDatabaseCreation; } + protected Attacher() + { + RequestsExternalDatabaseCreation = true; + } + public abstract void Check(ICheckNotifier notifier); diff --git a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs index 99e5853c54..316479816a 100644 --- a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs +++ b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteAttacher.cs @@ -24,7 +24,8 @@ namespace Rdmp.Core.DataLoad.Modules.Attachers; public class RemoteAttacher : Attacher, IPluginAttacher { - public RemoteAttacher(bool requestsExternalDatabaseCreation=true) : base(requestsExternalDatabaseCreation) { } + public RemoteAttacher(bool requestsExternalDatabaseCreation = true) : base(requestsExternalDatabaseCreation) { } + public RemoteAttacher() : base(true) { } [DemandsInitialization("How far back to pull data from")] public AttacherHistoricalDurations HistoricalFetchDuration { get; set; } diff --git a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs index fa7ff3cd9c..7d8122586e 100644 --- a/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs +++ b/Rdmp.Core/DataLoad/Modules/Attachers/RemoteTableAttacher.cs @@ -40,6 +40,9 @@ public class RemoteTableAttacher : RemoteAttacher public RemoteTableAttacher(bool requestsExternalDatabaseCreation=true) : base(requestsExternalDatabaseCreation) { } + public RemoteTableAttacher() : base(true) + { + } [DemandsInitialization( "The server to connect to (this replaces all other settings e.g. RemoteServer, RemoteDatabaseName etc")]