|
| 1 | +// == Compilation Diagnostics ========================================================================================== |
| 2 | +test.cs(18,50): error CS0229: Ambiguity between 'OrderPlaced.OrderId' and 'OrderPlaced.OrderId' |
| 3 | +test.cs(36,19): error CS0102: The type 'OrderPlaced' already contains a definition for 'OrderId' |
| 4 | + |
| 5 | +// == NServiceBus.Core.Analyzer/NServiceBus.Core.Analyzer.Sagas.AddSagaGenerator/HandlerRegistrations.Sagas.g.cs ======= |
| 6 | +// <auto-generated/> |
| 7 | + |
| 8 | +#nullable enable annotations |
| 9 | +#nullable disable warnings |
| 10 | + |
| 11 | +// Suppress warnings about [Obsolete] member usage in generated code. |
| 12 | +#pragma warning disable CS0612, CS0618 |
| 13 | + |
| 14 | +namespace NServiceBus |
| 15 | +{ |
| 16 | + public static partial class DuplicatePropertyDefinitionsWithCompilationErrorsHandlerRegistryExtensions |
| 17 | + { |
| 18 | + public sealed partial class DuplicatePropertyDefinitionsWithCompilationErrorsRootRegistry |
| 19 | + { |
| 20 | + partial void AddAllSagasCore() |
| 21 | + { |
| 22 | + AddOrderShippingPolicy(); |
| 23 | + } |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// Registers the <see cref="global::OrderShippingPolicy"/> saga with the endpoint configuration. |
| 27 | + /// </summary> |
| 28 | + public void AddOrderShippingPolicy() |
| 29 | + { |
| 30 | + var sagaMetadataCollection = NServiceBus.Configuration.AdvancedExtensibility.AdvancedExtensibilityExtensions.GetSettings(_configuration) |
| 31 | + .GetOrCreate<NServiceBus.Sagas.SagaMetadataCollection>(); |
| 32 | + var associatedMessages = new NServiceBus.Sagas.SagaMessage[] |
| 33 | + { |
| 34 | + new NServiceBus.Sagas.SagaMessage(typeof(global::OrderPlaced), true, false), |
| 35 | + }; |
| 36 | + NServiceBus.Sagas.MessagePropertyAccessor[] propertyAccessors = [ |
| 37 | + OrderPlacedOrderIdAccessor_5f69124e5a7de2e1.Instance, |
| 38 | + ]; |
| 39 | + var metadata = NServiceBus.Sagas.SagaMetadata.Create<global::OrderShippingPolicy, global::OrderShippingPolicyData>(associatedMessages, OrderIdAsStringAccessor_4a76700cf8410b3a.Instance, propertyAccessors); |
| 40 | + sagaMetadataCollection.Add(metadata); |
| 41 | + |
| 42 | + var settings = NServiceBus.Configuration.AdvancedExtensibility.AdvancedExtensibilityExtensions.GetSettings(_configuration); |
| 43 | + var messageHandlerRegistry = settings.GetOrCreate<NServiceBus.Unicast.MessageHandlerRegistry>(); |
| 44 | + var messageMetadataRegistry = settings.GetOrCreate<NServiceBus.Unicast.Messages.MessageMetadataRegistry>(); |
| 45 | + messageHandlerRegistry.AddMessageHandlerForMessage<global::OrderShippingPolicy, global::OrderPlaced>(); |
| 46 | + messageMetadataRegistry.RegisterMessageTypeWithHierarchy(typeof(global::OrderPlaced), []); |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("NService.Core.Analyzer.Tests", "1.0.0")] |
| 52 | + file sealed class OrderPlacedOrderIdAccessor_5f69124e5a7de2e1 : NServiceBus.Sagas.MessagePropertyAccessor<global::OrderPlaced> |
| 53 | + { |
| 54 | + OrderPlacedOrderIdAccessor_5f69124e5a7de2e1() { } |
| 55 | + |
| 56 | + protected override object? AccessFrom(global::OrderPlaced message) => AccessFrom_Property(message); |
| 57 | + |
| 58 | + [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "get_OrderId")] |
| 59 | + static extern string AccessFrom_Property(global::OrderPlaced message); |
| 60 | + |
| 61 | + public static readonly NServiceBus.Sagas.MessagePropertyAccessor Instance = new OrderPlacedOrderIdAccessor_5f69124e5a7de2e1(); |
| 62 | + } |
| 63 | + |
| 64 | + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("NService.Core.Analyzer.Tests", "1.0.0")] |
| 65 | + file sealed class OrderIdAsStringAccessor_4a76700cf8410b3a : NServiceBus.Sagas.CorrelationPropertyAccessor |
| 66 | + { |
| 67 | + OrderIdAsStringAccessor_4a76700cf8410b3a() { } |
| 68 | + |
| 69 | + public override object? AccessFrom(NServiceBus.IContainSagaData sagaData) => AccessFrom_Property(sagaData); |
| 70 | + |
| 71 | + [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "get_OrderId")] |
| 72 | + static extern string AccessFrom_Property(NServiceBus.IContainSagaData sagaData); |
| 73 | + |
| 74 | + public override void WriteTo(NServiceBus.IContainSagaData sagaData, object value) => WriteTo_Property(sagaData, ((string)value)); |
| 75 | + |
| 76 | + [global::System.Runtime.CompilerServices.UnsafeAccessor(global::System.Runtime.CompilerServices.UnsafeAccessorKind.Method, Name = "set_OrderId")] |
| 77 | + static extern string WriteTo_Property(NServiceBus.IContainSagaData sagaData, string value); |
| 78 | + |
| 79 | + public static readonly NServiceBus.Sagas.CorrelationPropertyAccessor Instance = new OrderIdAsStringAccessor_4a76700cf8410b3a(); |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +// == NServiceBus.Core.Analyzer/NServiceBus.Core.Analyzer.AddHandlerAndSagasRegistrationGenerator/HandlerRegistrations.g.cs == |
| 84 | +// <auto-generated/> |
| 85 | + |
| 86 | +#nullable enable annotations |
| 87 | +#nullable disable warnings |
| 88 | + |
| 89 | +// Suppress warnings about [Obsolete] member usage in generated code. |
| 90 | +#pragma warning disable CS0612, CS0618 |
| 91 | + |
| 92 | +namespace NServiceBus |
| 93 | +{ |
| 94 | + /// <summary> |
| 95 | + /// Provides access to handler and saga registries discovered in the <i>DuplicatePropertyDefinitionsWithCompilationErrors</i> assembly. |
| 96 | + /// </summary> |
| 97 | + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("NService.Core.Analyzer.Tests", "1.0.0")] |
| 98 | + public static partial class DuplicatePropertyDefinitionsWithCompilationErrorsHandlerRegistryExtensions |
| 99 | + { |
| 100 | + extension (global::NServiceBus.HandlerRegistry registry) |
| 101 | + { |
| 102 | + /// <summary> |
| 103 | + /// Gets the root registry for handler and saga types in the <i>DuplicatePropertyDefinitionsWithCompilationErrors</i> assembly. |
| 104 | + /// </summary> |
| 105 | + /// <remarks> |
| 106 | + /// Use the returned registry to access namespace-specific registries and add-all methods for this assembly. |
| 107 | + /// </remarks> |
| 108 | + public DuplicatePropertyDefinitionsWithCompilationErrorsRootRegistry DuplicatePropertyDefinitionsWithCompilationErrorsAssembly => new(registry.Configuration); |
| 109 | + } |
| 110 | + |
| 111 | + /// <summary> |
| 112 | + /// Root registry to add handlers and sagas for the entire assembly. |
| 113 | + /// </summary> |
| 114 | + public sealed partial class DuplicatePropertyDefinitionsWithCompilationErrorsRootRegistry(global::NServiceBus.EndpointConfiguration configuration) |
| 115 | + { |
| 116 | + readonly global::NServiceBus.EndpointConfiguration _configuration = configuration ?? throw new System.ArgumentNullException(nameof(configuration)); |
| 117 | + |
| 118 | + /// <summary> |
| 119 | + /// Registers all handlers and sagas for this namespace segment and its child namespaces. |
| 120 | + /// </summary> |
| 121 | + /// <remarks> |
| 122 | + /// Includes sagas in this namespace: <see cref="AddOrderShippingPolicy"/>. |
| 123 | + /// </remarks> |
| 124 | + public void AddAll() |
| 125 | + { |
| 126 | + AddAllHandlers(); |
| 127 | + AddAllSagas(); |
| 128 | + } |
| 129 | + |
| 130 | + /// <summary> |
| 131 | + /// Registers all handlers for this namespace segment and its child namespaces. |
| 132 | + /// </summary> |
| 133 | + public void AddAllHandlers() |
| 134 | + { |
| 135 | + AddAllHandlersCore(); |
| 136 | + } |
| 137 | + |
| 138 | + /// <summary> |
| 139 | + /// Registers all sagas for this namespace segment and its child namespaces. |
| 140 | + /// </summary> |
| 141 | + /// <remarks> |
| 142 | + /// Includes sagas in this namespace: <see cref="AddOrderShippingPolicy"/>. |
| 143 | + /// </remarks> |
| 144 | + public void AddAllSagas() |
| 145 | + { |
| 146 | + AddAllSagasCore(); |
| 147 | + } |
| 148 | + |
| 149 | + partial void AddAllHandlersCore(); |
| 150 | + partial void AddAllSagasCore(); |
| 151 | + } |
| 152 | + } |
| 153 | +} |
0 commit comments