Skip to content

Commit

Permalink
Update MEDI annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
hwoodiwiss committed Feb 27, 2024
1 parent ffa2d31 commit 470e3fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Text.Json;
using JustSaying.Messaging;
using JustSaying.Messaging.MessageSerialization;
using JustSaying.Sample.Restaurant.Models;
Expand Down Expand Up @@ -39,6 +38,7 @@
builder.Services.AddSingleton<IMessageSerializationFactory>(sp =>
new SystemTextJsonSerializationFactory(sp.GetRequiredService<IOptions<JustSayingJsonSerializerOptions>>().Value.SerializerOptions));

#pragma warning disable IL2026 // We provide SystemTextJsonSerializationFactory, which is trimming safe
builder.Services.AddJustSaying(config =>
{
config.Client(x =>
Expand Down Expand Up @@ -81,6 +81,7 @@
x.WithTopic<OrderOnItsWayEvent>();
});
});
#pragma warning restore IL2026

// Added a message handler for message type for 'OrderReadyEvent' on topic 'orderreadyevent' and queue 'orderreadyevent'
builder.Services.AddJustSayingHandler<OrderReadyEvent, OrderReadyEventHandler>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace Microsoft.Extensions.DependencyInjection;
[EditorBrowsable(EditorBrowsableState.Never)]
public static class IServiceCollectionExtensions
{
private const string UnreferencedCodeMessage = "The default IMessageSerializationFactory requires unreferenced code.";

/// <summary>
/// Adds JustSaying services to the service collection.
/// </summary>
Expand All @@ -36,6 +38,9 @@ public static class IServiceCollectionExtensions
/// <exception cref="ArgumentNullException">
/// <paramref name="services"/> is <see langword="null"/>.
/// </exception>
#if NET8_0_OR_GREATER
[RequiresUnreferencedCode(UnreferencedCodeMessage)]
#endif
public static IServiceCollection AddJustSaying(this IServiceCollection services)
{
if (services == null)
Expand All @@ -57,6 +62,9 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services)
/// <exception cref="ArgumentNullException">
/// <paramref name="services"/> or <paramref name="region"/> is <see langword="null"/>.
/// </exception>
#if NET8_0_OR_GREATER
[RequiresUnreferencedCode(UnreferencedCodeMessage)]
#endif
public static IServiceCollection AddJustSaying(this IServiceCollection services, string region)
{
if (services == null)
Expand Down Expand Up @@ -85,6 +93,9 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services,
/// <exception cref="ArgumentNullException">
/// <paramref name="services"/> or <paramref name="configure"/> is <see langword="null"/>.
/// </exception>
#if NET8_0_OR_GREATER
[RequiresUnreferencedCode(UnreferencedCodeMessage)]
#endif
public static IServiceCollection AddJustSaying(this IServiceCollection services, Action<MessagingBusBuilder> configure)
{
if (services == null)
Expand All @@ -111,6 +122,9 @@ public static IServiceCollection AddJustSaying(this IServiceCollection services,
/// <exception cref="ArgumentNullException">
/// <paramref name="services"/> or <paramref name="configure"/> is <see langword="null"/>.
/// </exception>
#if NET8_0_OR_GREATER
[RequiresUnreferencedCode(UnreferencedCodeMessage)]
#endif
public static IServiceCollection AddJustSaying(this IServiceCollection services, Action<MessagingBusBuilder, IServiceProvider> configure)
{
if (services == null)
Expand Down

0 comments on commit 470e3fe

Please sign in to comment.