diff --git a/src/TypedSignalR.Client/CodeAnalysis/ParameterMetadata.cs b/src/TypedSignalR.Client/CodeAnalysis/ParameterMetadata.cs index b126513..3c5deca 100644 --- a/src/TypedSignalR.Client/CodeAnalysis/ParameterMetadata.cs +++ b/src/TypedSignalR.Client/CodeAnalysis/ParameterMetadata.cs @@ -10,6 +10,7 @@ public readonly record struct ParameterMetadata public readonly string TypeName; public ITypeSymbol Type => ParameterSymbol.Type; + public string FullyQualifiedTypeName => ParameterSymbol.Type.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat); public ParameterMetadata(IParameterSymbol parameterSymbol) { diff --git a/src/TypedSignalR.Client/CodeAnalysis/TypeMetadata.cs b/src/TypedSignalR.Client/CodeAnalysis/TypeMetadata.cs index 9f88c93..edb3cc8 100644 --- a/src/TypedSignalR.Client/CodeAnalysis/TypeMetadata.cs +++ b/src/TypedSignalR.Client/CodeAnalysis/TypeMetadata.cs @@ -11,7 +11,7 @@ public sealed class TypeMetadata : ITypeSymbolHolder public IReadOnlyList Methods { get; } public string InterfaceName { get; } - public string InterfaceFullName { get; } + public string FullyQualifiedInterfaceName { get; } public string CollisionFreeName { get; } public TypeMetadata(ITypeSymbol typeSymbol) @@ -21,8 +21,8 @@ public TypeMetadata(ITypeSymbol typeSymbol) Methods = GetMethods(typeSymbol); InterfaceName = typeSymbol.Name; - InterfaceFullName = typeSymbol.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat); - CollisionFreeName = InterfaceFullName.Replace('.', '_').Replace(':', '_'); + FullyQualifiedInterfaceName = typeSymbol.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat); + CollisionFreeName = FullyQualifiedInterfaceName.Replace('.', '_').Replace(':', '_'); } private static IReadOnlyList GetMethods(ITypeSymbol typeSymbol) diff --git a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs index 7e20a7d..c7ba6b4 100644 --- a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs +++ b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsBinderTemplate.cs @@ -33,9 +33,9 @@ internal static partial class HubConnectionExtensions foreach (var receiverType in _receiverTypes) { sb.AppendLine($$""" - private sealed class BinderFor_{{receiverType.CollisionFreeName}} : IReceiverBinder<{{receiverType.InterfaceFullName}}> + private sealed class BinderFor_{{receiverType.CollisionFreeName}} : IReceiverBinder<{{receiverType.FullyQualifiedInterfaceName}}> { - public global::System.IDisposable Bind(global::Microsoft.AspNetCore.SignalR.Client.HubConnection connection, {{receiverType.InterfaceFullName}} receiver) + public global::System.IDisposable Bind(global::Microsoft.AspNetCore.SignalR.Client.HubConnection connection, {{receiverType.FullyQualifiedInterfaceName}} receiver) { var compositeDisposable = new CompositeDisposable({{receiverType.Methods.Count}}); @@ -58,7 +58,7 @@ private sealed class BinderFor_{{receiverType.CollisionFreeName}} : IReceiverBin foreach (var receiverType in _receiverTypes) { sb.AppendLine($$""" - binders.Add(typeof({{receiverType.InterfaceFullName}}), new BinderFor_{{receiverType.CollisionFreeName}}()); + binders.Add(typeof({{receiverType.FullyQualifiedInterfaceName}}), new BinderFor_{{receiverType.CollisionFreeName}}()); """); } diff --git a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs index 47cd14d..bc2a6c4 100644 --- a/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs +++ b/src/TypedSignalR.Client/Templates/HubConnectionExtensionsHubInvokerTemplate.cs @@ -37,7 +37,7 @@ internal static partial class HubConnectionExtensions foreach (var hubType in _hubTypes) { sb.AppendLine($$""" - private sealed class HubInvokerFor_{{hubType.CollisionFreeName}} : {{hubType.InterfaceFullName}}, IHubInvoker + private sealed class HubInvokerFor_{{hubType.CollisionFreeName}} : {{hubType.FullyQualifiedInterfaceName}}, IHubInvoker { private readonly global::Microsoft.AspNetCore.SignalR.Client.HubConnection _connection; private readonly global::System.Threading.CancellationToken _cancellationToken; @@ -50,9 +50,9 @@ private sealed class HubInvokerFor_{{hubType.CollisionFreeName}} : {{hubType.Int {{CreateMethodsString(hubType)}} } - private sealed class HubInvokerFactoryFor_{{hubType.CollisionFreeName}} : IHubInvokerFactory<{{hubType.InterfaceFullName}}> + private sealed class HubInvokerFactoryFor_{{hubType.CollisionFreeName}} : IHubInvokerFactory<{{hubType.FullyQualifiedInterfaceName}}> { - public {{hubType.InterfaceFullName}} CreateHubInvoker(global::Microsoft.AspNetCore.SignalR.Client.HubConnection connection, global::System.Threading.CancellationToken cancellationToken) + public {{hubType.FullyQualifiedInterfaceName}} CreateHubInvoker(global::Microsoft.AspNetCore.SignalR.Client.HubConnection connection, global::System.Threading.CancellationToken cancellationToken) { return new HubInvokerFor_{{hubType.CollisionFreeName}}(connection, cancellationToken); } @@ -72,7 +72,7 @@ private sealed class HubInvokerFactoryFor_{{hubType.CollisionFreeName}} : IHubIn foreach (var hubType in _hubTypes) { sb.AppendLine($$""" - factories.Add(typeof({{hubType.InterfaceFullName}}), new HubInvokerFactoryFor_{{hubType.CollisionFreeName}}()); + factories.Add(typeof({{hubType.FullyQualifiedInterfaceName}}), new HubInvokerFactoryFor_{{hubType.CollisionFreeName}}()); """); } diff --git a/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs b/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs index 08f37e9..634ec05 100644 --- a/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs +++ b/src/TypedSignalR.Client/Templates/MethodMetadataExtensions.cs @@ -138,17 +138,17 @@ public static string CreateParameterTypeArrayString(this MethodMetadata methodMe if (methodMetadata.Parameters.Count == 1) { - return $"new[] {{ typeof({methodMetadata.Parameters[0].Type.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat)}) }}"; + return $"new[] {{ typeof({methodMetadata.Parameters[0].FullyQualifiedTypeName}) }}"; } var sb = new StringBuilder(); sb.Append("new[] { "); - sb.Append($"typeof({methodMetadata.Parameters[0].Type.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat)})"); + sb.Append($"typeof({methodMetadata.Parameters[0].FullyQualifiedTypeName})"); for (int i = 1; i < methodMetadata.Parameters.Count; i++) { - sb.Append($", typeof({methodMetadata.Parameters[i].Type.ToDisplayString(SymbolDisplayFormatRule.FullyQualifiedFormat)})"); + sb.Append($", typeof({methodMetadata.Parameters[i].FullyQualifiedTypeName})"); } sb.Append(" }");