Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike moving ICommand, IEvent, IMessage to different assembly #6796

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(EndpointConfiguration).Assembly))
{
RegisteredServices[serviceDescriptor.ServiceType] = new RegisteredService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ static AnalyzerTestFixture()
MetadataReference.CreateFromFile(Assembly.Load("System.Private.CoreLib").Location),
#endif
MetadataReference.CreateFromFile(typeof(EndpointConfiguration).GetTypeInfo().Assembly.Location),
MetadataReference.CreateFromFile(typeof(IMessage).GetTypeInfo().Assembly.Location),
MetadataReference.CreateFromFile(typeof(IUniformSession).GetTypeInfo().Assembly.Location));
}

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(EndpointConfiguration).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(EndpointConfiguration).Assembly)
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,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(EndpointConfiguration).Assembly;
}
return null;
}
Expand Down
13 changes: 4 additions & 9 deletions src/NServiceBus.Core/ICommand.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
namespace NServiceBus
{
/// <summary>
/// Marker interface to indicate that a class is a command message.
/// </summary>
public interface ICommand : IMessage
{
}
}
using System.Runtime.CompilerServices;
using NServiceBus;

[assembly: TypeForwardedTo(typeof(ICommand))]
13 changes: 4 additions & 9 deletions src/NServiceBus.Core/IEvent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
namespace NServiceBus
{
/// <summary>
/// Marker interface to indicate that a class is a event message.
/// </summary>
public interface IEvent : IMessage
{
}
}
using System.Runtime.CompilerServices;
using NServiceBus;

[assembly: TypeForwardedTo(typeof(IEvent))]
14 changes: 4 additions & 10 deletions src/NServiceBus.Core/IMessage.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
namespace NServiceBus
{
/// <summary>
/// Marker interface to indicate that a class is a message suitable
/// for transmission and handling by an NServiceBus.
/// </summary>
public interface IMessage
{
}
}
using System.Runtime.CompilerServices;
using NServiceBus;

[assembly: TypeForwardedTo(typeof(IMessage))]
2 changes: 2 additions & 0 deletions src/NServiceBus.Core/NServiceBus.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<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" />
<!-- Would be a package dependency to 1.0.0 in real life -->
<Projectreference Include="..\NServiceBus.MessageAbstractions\NServiceBus.MessageAbstractions.csproj" />
</ItemGroup>

<ItemGroup Label="Private dependencies">
Expand Down
9 changes: 9 additions & 0 deletions src/NServiceBus.MessageAbstractions/ICommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace NServiceBus
{
/// <summary>
/// Marker interface to indicate that a class is a command message.
/// </summary>
public interface ICommand : IMessage
{
}
}
9 changes: 9 additions & 0 deletions src/NServiceBus.MessageAbstractions/IEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace NServiceBus
{
/// <summary>
/// Marker interface to indicate that a class is a event message.
/// </summary>
public interface IEvent : IMessage
{
}
}
10 changes: 10 additions & 0 deletions src/NServiceBus.MessageAbstractions/IMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace NServiceBus
{
/// <summary>
/// Marker interface to indicate that a class is a message suitable
/// for transmission and handling by an NServiceBus.
/// </summary>
public interface IMessage
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBus.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup Label="Private dependencies">
<PackageReference Include="Particular.Packaging" Version="3.0.0" PrivateAssets="All" />
</ItemGroup>

</Project>
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(EndpointConfiguration).Assembly;

var nonCoreTransport = transportDefinitions.Value.FirstOrDefault(t => t.Assembly != coreAssembly);

Expand Down
6 changes: 6 additions & 0 deletions src/NServiceBus.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Learning.Accept
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Core.Analyzer.Tests.Roslyn4", "NServiceBus.Core.Analyzer.Tests.Roslyn4\NServiceBus.Core.Analyzer.Tests.Roslyn4.csproj", "{71330321-DA6D-4199-89C4-FB36F92E77C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.MessageAbstractions", "NServiceBus.MessageAbstractions\NServiceBus.MessageAbstractions.csproj", "{9BF4758C-DC80-4D91-87DA-623B8FA20CAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -94,6 +96,10 @@ Global
{71330321-DA6D-4199-89C4-FB36F92E77C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71330321-DA6D-4199-89C4-FB36F92E77C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71330321-DA6D-4199-89C4-FB36F92E77C2}.Release|Any CPU.Build.0 = Release|Any CPU
{9BF4758C-DC80-4D91-87DA-623B8FA20CAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BF4758C-DC80-4D91-87DA-623B8FA20CAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BF4758C-DC80-4D91-87DA-623B8FA20CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BF4758C-DC80-4D91-87DA-623B8FA20CAA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down