diff --git a/src/NServiceBus.AcceptanceTests/Core/DependencyInjection/When_endpoint_is_warmed_up.cs b/src/NServiceBus.AcceptanceTests/Core/DependencyInjection/When_endpoint_is_warmed_up.cs index b2c4b545fc4..2c214726b4c 100644 --- a/src/NServiceBus.AcceptanceTests/Core/DependencyInjection/When_endpoint_is_warmed_up.cs +++ b/src/NServiceBus.AcceptanceTests/Core/DependencyInjection/When_endpoint_is_warmed_up.cs @@ -115,7 +115,7 @@ class SpyContainer : IServiceProvider, IServiceScopeFactory public SpyContainer(IServiceCollection serviceCollection) { foreach (var serviceDescriptor in serviceCollection - .Where(sd => sd.ServiceType.Assembly == typeof(IMessage).Assembly)) + .Where(sd => sd.ServiceType.Assembly == typeof(IEndpointInstance).Assembly)) { RegisteredServices[serviceDescriptor.ServiceType] = new RegisteredService { diff --git a/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs b/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs index b98dffcce2d..d230b9e58ab 100644 --- a/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs +++ b/src/NServiceBus.Core.Analyzer.Tests.Common/Helpers/AnalyzerTestFixture.cs @@ -114,7 +114,8 @@ static AnalyzerTestFixture() MetadataReference.CreateFromFile(Assembly.Load("System.Private.CoreLib").Location), #endif MetadataReference.CreateFromFile(typeof(EndpointConfiguration).GetTypeInfo().Assembly.Location), - MetadataReference.CreateFromFile(typeof(IUniformSession).GetTypeInfo().Assembly.Location)); + MetadataReference.CreateFromFile(typeof(IUniformSession).GetTypeInfo().Assembly.Location), + MetadataReference.CreateFromFile(typeof(IMessage).GetTypeInfo().Assembly.Location)); } static readonly ImmutableList ProjectReferences; diff --git a/src/NServiceBus.Core.Tests/API/Infra/NServiceBusAssembly.cs b/src/NServiceBus.Core.Tests/API/Infra/NServiceBusAssembly.cs index c286a6d921b..1182a48a27b 100644 --- a/src/NServiceBus.Core.Tests/API/Infra/NServiceBusAssembly.cs +++ b/src/NServiceBus.Core.Tests/API/Infra/NServiceBusAssembly.cs @@ -6,7 +6,7 @@ static class NServiceBusAssembly { - public static readonly List Types = typeof(IMessage).Assembly.GetTypes() + public static readonly List Types = typeof(IEndpointInstance).Assembly.GetTypes() .Where(type => !type.IsObsolete()) .ToList(); } diff --git a/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs b/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs index d3b07553882..69e3972b48b 100644 --- a/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs +++ b/src/NServiceBus.Core.Tests/API/NullableAnnotations.cs @@ -52,7 +52,7 @@ bool HasNonAnnotatedMember(Type type) { foreach (var member in type.GetMembers()) { - if (member.DeclaringType.Assembly != typeof(IMessage).Assembly) + if (member.DeclaringType.Assembly != typeof(IEndpointInstance).Assembly) { continue; } diff --git a/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt b/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt index 4dedc89a527..7fe97127a71 100644 --- a/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt +++ b/src/NServiceBus.Core.Tests/ApprovalFiles/APIApprovals.ApproveNServiceBus.approved.txt @@ -478,7 +478,6 @@ namespace NServiceBus { System.Threading.CancellationToken CancellationToken { get; } } - public interface ICommand : NServiceBus.IMessage { } public interface IConfigureHowToFindSagaWithMessage { void ConfigureMapping(System.Linq.Expressions.Expression> sagaEntityProperty, System.Linq.Expressions.Expression> messageProperty) @@ -517,7 +516,6 @@ namespace NServiceBus { System.Threading.Tasks.Task Stop(System.Threading.CancellationToken cancellationToken = default); } - public interface IEvent : NServiceBus.IMessage { } public interface IHandleMessages { System.Threading.Tasks.Task Handle(T message, NServiceBus.IMessageHandlerContext context); @@ -526,7 +524,6 @@ namespace NServiceBus { System.Threading.Tasks.Task Timeout(T state, NServiceBus.IMessageHandlerContext context); } - public interface IMessage { } public interface IMessageConvention { string Name { get; } diff --git a/src/NServiceBus.Core.Tests/RedirectHelper.cs b/src/NServiceBus.Core.Tests/RedirectHelper.cs index fd726c0dc67..9a501340ace 100644 --- a/src/NServiceBus.Core.Tests/RedirectHelper.cs +++ b/src/NServiceBus.Core.Tests/RedirectHelper.cs @@ -17,7 +17,7 @@ static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs ar { if (args.Name.StartsWith("NServiceBus.Core,")) { - return typeof(IMessage).Assembly; + return typeof(IEndpointInstance).Assembly; } return null; } diff --git a/src/NServiceBus.Core/ICommand.cs b/src/NServiceBus.Core/ICommand.cs deleted file mode 100644 index 893545427bb..00000000000 --- a/src/NServiceBus.Core/ICommand.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace NServiceBus -{ - /// - /// Marker interface to indicate that a class is a command message. - /// - public interface ICommand : IMessage - { - } -} \ No newline at end of file diff --git a/src/NServiceBus.Core/IEvent.cs b/src/NServiceBus.Core/IEvent.cs deleted file mode 100644 index a91c801b90f..00000000000 --- a/src/NServiceBus.Core/IEvent.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace NServiceBus -{ - /// - /// Marker interface to indicate that a class is a event message. - /// - public interface IEvent : IMessage - { - } -} \ No newline at end of file diff --git a/src/NServiceBus.Core/IMessage.cs b/src/NServiceBus.Core/IMessage.cs deleted file mode 100644 index 8f1e1a7aa03..00000000000 --- a/src/NServiceBus.Core/IMessage.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace NServiceBus -{ - /// - /// Marker interface to indicate that a class is a message suitable - /// for transmission and handling by an NServiceBus. - /// - public interface IMessage - { - } -} \ No newline at end of file diff --git a/src/NServiceBus.Core/NServiceBus.Core.csproj b/src/NServiceBus.Core/NServiceBus.Core.csproj index ea62312ef16..327a7d587ef 100644 --- a/src/NServiceBus.Core/NServiceBus.Core.csproj +++ b/src/NServiceBus.Core/NServiceBus.Core.csproj @@ -18,6 +18,7 @@ + diff --git a/src/NServiceBus.Core/TypeForwarders.cs b/src/NServiceBus.Core/TypeForwarders.cs new file mode 100644 index 00000000000..de420343ca9 --- /dev/null +++ b/src/NServiceBus.Core/TypeForwarders.cs @@ -0,0 +1,6 @@ +using System.Runtime.CompilerServices; +using NServiceBus; + +[assembly: TypeForwardedTo(typeof(ICommand))] +[assembly: TypeForwardedTo(typeof(IEvent))] +[assembly: TypeForwardedTo(typeof(IMessage))] diff --git a/src/NServiceBus.TransportTests/NServiceBusTransportTest.cs b/src/NServiceBus.TransportTests/NServiceBusTransportTest.cs index ee7afdb36ef..041b2af11b2 100644 --- a/src/NServiceBus.TransportTests/NServiceBusTransportTest.cs +++ b/src/NServiceBus.TransportTests/NServiceBusTransportTest.cs @@ -39,7 +39,7 @@ protected static IConfigureTransportInfrastructure CreateConfigurer() if (string.IsNullOrWhiteSpace(transportToUse)) { - var coreAssembly = typeof(IMessage).Assembly; + var coreAssembly = typeof(IEndpointInstance).Assembly; var nonCoreTransport = transportDefinitions.Value.FirstOrDefault(t => t.Assembly != coreAssembly);