| | | 1 | | using System; |
| | | 2 | | using System.Collections.Immutable; |
| | | 3 | | |
| | | 4 | | namespace NexusLabs.Needlr.AgentFramework.Generators.Models |
| | | 5 | | { |
| | | 6 | | /// <summary> |
| | | 7 | | /// Discovered metadata for an interface decorated with [AsyncLocalScoped]. |
| | | 8 | | /// </summary> |
| | | 9 | | internal readonly struct AsyncLocalScopedInfo |
| | | 10 | | { |
| | | 11 | | public AsyncLocalScopedInfo( |
| | | 12 | | string interfaceFullName, |
| | | 13 | | string interfaceName, |
| | | 14 | | string namespaceName, |
| | | 15 | | string valueTypeFullName, |
| | | 16 | | string scopeMethodName, |
| | | 17 | | bool hasScopeParameter, |
| | | 18 | | string scopeParameterTypeFullName, |
| | | 19 | | bool isMutable, |
| | | 20 | | ImmutableArray<AsyncLocalScopedPropertyInfo> proxyProperties) |
| | | 21 | | { |
| | 8 | 22 | | InterfaceFullName = interfaceFullName; |
| | 8 | 23 | | InterfaceName = interfaceName; |
| | 8 | 24 | | NamespaceName = namespaceName; |
| | 8 | 25 | | ValueTypeFullName = valueTypeFullName; |
| | 8 | 26 | | ScopeMethodName = scopeMethodName; |
| | 8 | 27 | | HasScopeParameter = hasScopeParameter; |
| | 8 | 28 | | ScopeParameterTypeFullName = scopeParameterTypeFullName; |
| | 8 | 29 | | IsMutable = isMutable; |
| | 8 | 30 | | ProxyProperties = proxyProperties; |
| | 8 | 31 | | } |
| | | 32 | | |
| | 16 | 33 | | public string InterfaceFullName { get; } |
| | 32 | 34 | | public string InterfaceName { get; } |
| | 24 | 35 | | public string NamespaceName { get; } |
| | 8 | 36 | | public string ValueTypeFullName { get; } |
| | 8 | 37 | | public string ScopeMethodName { get; } |
| | 8 | 38 | | public bool HasScopeParameter { get; } |
| | 6 | 39 | | public string ScopeParameterTypeFullName { get; } |
| | 8 | 40 | | public bool IsMutable { get; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Properties on the accessor interface (beyond <c>Current</c>) that |
| | | 44 | | /// should be proxied through to <c>Current?.PropertyName</c>. |
| | | 45 | | /// Empty when the interface declares no extra properties. |
| | | 46 | | /// </summary> |
| | 12 | 47 | | public ImmutableArray<AsyncLocalScopedPropertyInfo> ProxyProperties { get; } |
| | | 48 | | |
| | | 49 | | public string GeneratedClassName |
| | | 50 | | { |
| | | 51 | | get |
| | | 52 | | { |
| | 8 | 53 | | return InterfaceName.StartsWith("I", StringComparison.Ordinal) && InterfaceName.Length > 1 |
| | 8 | 54 | | ? InterfaceName.Substring(1) |
| | 8 | 55 | | : InterfaceName + "Impl"; |
| | | 56 | | } |
| | | 57 | | } |
| | | 58 | | } |
| | | 59 | | } |