Skip to content

Commit

Permalink
Add NServiceBus.MessageInterfaces package (#6977)
Browse files Browse the repository at this point in the history
* Add NServiceBus.MessageInterfaces

* Adjust references to IMessage

* Update API approval file
  • Loading branch information
bording committed Mar 19, 2024
1 parent e2a9813 commit f0ae530
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PortableExecutableReference> ProjectReferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

static class NServiceBusAssembly
{
public static readonly List<Type> Types = typeof(IMessage).Assembly.GetTypes()
public static readonly List<Type> Types = typeof(IEndpointInstance).Assembly.GetTypes()
.Where(type => !type.IsObsolete())
.ToList();
}
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.Core.Tests/API/NullableAnnotations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ namespace NServiceBus
{
System.Threading.CancellationToken CancellationToken { get; }
}
public interface ICommand : NServiceBus.IMessage { }
public interface IConfigureHowToFindSagaWithMessage
{
void ConfigureMapping<TSagaEntity, TMessage>(System.Linq.Expressions.Expression<System.Func<TSagaEntity, object?>> sagaEntityProperty, System.Linq.Expressions.Expression<System.Func<TMessage, object?>> messageProperty)
Expand Down Expand Up @@ -517,7 +516,6 @@ namespace NServiceBus
{
System.Threading.Tasks.Task Stop(System.Threading.CancellationToken cancellationToken = default);
}
public interface IEvent : NServiceBus.IMessage { }
public interface IHandleMessages<T>
{
System.Threading.Tasks.Task Handle(T message, NServiceBus.IMessageHandlerContext context);
Expand All @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.Core.Tests/RedirectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 0 additions & 9 deletions src/NServiceBus.Core/ICommand.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/NServiceBus.Core/IEvent.cs

This file was deleted.

10 changes: 0 additions & 10 deletions src/NServiceBus.Core/IMessage.cs

This file was deleted.

1 change: 1 addition & 0 deletions src/NServiceBus.Core/NServiceBus.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<ItemGroup Label="Public dependencies">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="NServiceBus.MessageInterfaces" Version="[1.0.0, 2.0.0)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="7.0.2" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
Expand Down
6 changes: 6 additions & 0 deletions src/NServiceBus.Core/TypeForwarders.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System.Runtime.CompilerServices;
using NServiceBus;

[assembly: TypeForwardedTo(typeof(ICommand))]
[assembly: TypeForwardedTo(typeof(IEvent))]
[assembly: TypeForwardedTo(typeof(IMessage))]
2 changes: 1 addition & 1 deletion src/NServiceBus.TransportTests/NServiceBusTransportTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit f0ae530

Please sign in to comment.