33 writes to TypeId
Aspire.Hosting.RemoteHost (31)
AtsCapabilityScanner.cs (31)
764
TypeId
= originalTarget,
794
TypeId
= typeInfo.AtsTypeId,
1100
: new AtsTypeRef {
TypeId
= AtsConstants.Any, Category = AtsTypeCategory.Primitive };
1104
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
1127
propertyTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Any, Category = AtsTypeCategory.Primitive };
1146
TypeId
= typeId,
1252
TypeId
= typeId,
1569
? new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback }
1623
returnTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1627
returnTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1635
?? new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
1636
: new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1641
?? new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
1669
var voidTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1988
TypeId
= AtsConstants.Void,
2056
return new AtsTypeRef {
TypeId
= primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive };
2062
return new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive };
2073
TypeId
= AtsConstants.EnumTypeId(type.FullName ?? type.Name),
2096
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2119
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2141
TypeId
= AtsConstants.ListTypeId(elementTypeRef.TypeId),
2161
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2189
TypeId
= constraintTypeId,
2200
TypeId
= typeId,
2220
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2236
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2248
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2258
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2338
TypeId
= ifaceTypeId,
2373
TypeId
= baseTypeId,
2633
TypeId
= string.Join("|", unionTypes.Select(u => u.TypeId)),
Aspire.Hosting.RemoteHost.Tests (2)
AtsMarshallerTests.cs (2)
192
TypeId
= AtsConstants.CancellationToken,
730
var typeRef = new AtsTypeRef {
TypeId
= "test/SelfReferencingDto", Category = AtsTypeCategory.Dto };
186 references to TypeId
Aspire.Hosting.CodeGeneration.Go (15)
AtsGoCodeGenerator.cs (15)
295
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
606
if (targetType.
TypeId
is null)
611
if (!result.TryGetValue(targetType.
TypeId
, out var list))
614
result[targetType.
TypeId
] = list;
656
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
663
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
664
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
665
AtsTypeCategory.Handle => "*" + MapHandleType(typeRef.
TypeId
),
666
AtsTypeCategory.Dto => "*" + MapDtoType(typeRef.
TypeId
),
720
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
734
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
735
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
742
handleTypeIds.Add(typeRef.
TypeId
);
757
typeIds[typeRef.
TypeId
] = false; // false = List
764
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Go.Tests (2)
AtsGoCodeGeneratorTests.cs (2)
83
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
201
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.Java (15)
AtsJavaCodeGenerator.cs (15)
275
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
576
if (targetType.
TypeId
is null)
581
if (!result.TryGetValue(targetType.
TypeId
, out var list))
584
result[targetType.
TypeId
] = list;
624
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
631
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
, isOptional),
632
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
633
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
634
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
676
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
690
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
691
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
698
handleTypeIds.Add(typeRef.
TypeId
);
713
typeIds[typeRef.
TypeId
] = false; // false = List
720
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Java.Tests (2)
AtsJavaCodeGeneratorTests.cs (2)
82
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
200
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.Python (13)
AtsPythonCodeGenerator.cs (13)
289
if (capability.ReturnType.
TypeId
== AtsConstants.Void)
481
if (targetType.
TypeId
is null)
486
if (!result.TryGetValue(targetType.
TypeId
, out var list))
489
result[targetType.
TypeId
] = list;
575
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
582
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
583
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
584
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
585
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
650
parameter.Type?.
TypeId
== AtsConstants.CancellationToken;
661
handleTypeIds.Add(typeRef.
TypeId
);
676
typeIds[typeRef.
TypeId
] = false; // false = List
683
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Python.Tests (2)
AtsPythonCodeGeneratorTests.cs (2)
83
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
201
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.Rust (23)
AtsRustCodeGenerator.cs (23)
321
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
454
var wrappedType = MapHandleType(returnTypeRef.
TypeId
);
458
else if (returnTypeRef?.
TypeId
== AtsConstants.CancellationToken)
684
if (targetType.
TypeId
is null)
689
if (!result.TryGetValue(targetType.
TypeId
, out var list))
692
result[targetType.
TypeId
] = list;
731
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
738
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
739
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
740
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
741
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
769
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
776
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
777
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
780
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
828
var baseType = typeRef.
TypeId
switch
852
&& typeRef.
TypeId
!= AtsConstants.ReferenceExpressionTypeId
853
&& !IsCancellationTokenTypeId(typeRef.
TypeId
);
867
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
881
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
882
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
889
handleTypeIds.Add(typeRef.
TypeId
);
904
typeIds.Add(typeRef.
TypeId
);
Aspire.Hosting.CodeGeneration.Rust.Tests (2)
AtsRustCodeGeneratorTests.cs (2)
83
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
201
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.TypeScript (53)
AtsTypeScriptCodeGenerator.cs (53)
143
if (_wrapperClassNames.TryGetValue(typeRef.
TypeId
, out var wrapperClassName))
149
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
156
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
157
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
158
AtsTypeCategory.Handle => GetWrapperOrHandleName(typeRef.
TypeId
),
159
AtsTypeCategory.Dto => GetDtoInterfaceName(typeRef.
TypeId
),
291
private static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.
TypeId
== AtsConstants.CancellationToken;
329
private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.
TypeId
;
434
if (IsHandleType(cap.ReturnType) && !dtoTypeIds.Contains(cap.ReturnType!.
TypeId
))
441
if (IsHandleType(param.Type) && !dtoTypeIds.Contains(param.Type!.
TypeId
))
443
typeIds.Add(param.Type!.
TypeId
);
450
if (IsHandleType(cbParam.Type) && !dtoTypeIds.Contains(cbParam.Type.
TypeId
))
452
typeIds.Add(cbParam.Type.
TypeId
);
845
var aTypeId = a.Type?.
TypeId
;
846
var bTypeId = b.Type?.
TypeId
;
870
if (!string.Equals(aCallbackParams[i].Type.
TypeId
, bCallbackParams[i].Type.
TypeId
, StringComparison.Ordinal))
877
var aReturnTypeId = a.CallbackReturnType?.
TypeId
;
878
var bReturnTypeId = b.CallbackReturnType?.
TypeId
;
1013
if (capability.ReturnsBuilder && capability.ReturnType?.
TypeId
!= null &&
1014
!string.Equals(capability.ReturnType.
TypeId
, builder.TypeId, StringComparison.Ordinal) &&
1015
!string.Equals(capability.ReturnType.
TypeId
, capability.TargetTypeId, StringComparison.Ordinal))
1017
returnTypeId = capability.ReturnType.
TypeId
;
1057
if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1250
if (capability.ReturnsBuilder && capability.ReturnType?.
TypeId
!= null &&
1251
!string.Equals(capability.ReturnType.
TypeId
, builder.TypeId, StringComparison.Ordinal) &&
1252
!string.Equals(capability.ReturnType.
TypeId
, capability.TargetTypeId, StringComparison.Ordinal))
1254
var returnClass = _wrapperClassNames.GetValueOrDefault(capability.ReturnType.
TypeId
)
1255
?? DeriveClassName(capability.ReturnType.
TypeId
);
1371
else if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1410
var returnType = callbackReturnType == null || callbackReturnType.
TypeId
== AtsConstants.Void
1472
&& callbackParam.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1485
var cbTypeId = cbParam.Type.
TypeId
;
1513
var cbTypeId = cbParam.Type.
TypeId
;
1854
if (getter.ReturnType?.
TypeId
!= null && _wrapperClassNames.TryGetValue(getter.ReturnType.
TypeId
, out var wrapperClassName))
1873
if (getter.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1916
var handleType = GetHandleTypeName(getter.ReturnType!.
TypeId
);
2104
else if (method.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2255
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
2266
var returnWrapperClass = _wrapperClassNames.GetValueOrDefault(capability.ReturnType!.
TypeId
)
2267
?? DeriveClassName(capability.ReturnType.
TypeId
);
2268
var returnHandleType = GetHandleTypeName(capability.ReturnType.
TypeId
);
2376
if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2463
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
2562
if (!capabilitiesByTypeId.TryGetValue(expandedType.
TypeId
, out var list))
2565
capabilitiesByTypeId[expandedType.
TypeId
] = list;
2567
typeRefsByTypeId[expandedType.
TypeId
] = expandedType;
2724
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Handle)
2726
typeRefs.TryAdd(typeRef.
TypeId
, typeRef);
2853
if (_typesWithPromiseWrappers.Contains(returnType.
TypeId
))
2855
var className = _wrapperClassNames.GetValueOrDefault(returnType.
TypeId
)
2856
?? DeriveClassName(returnType.
TypeId
);
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
115
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
152
Assert.Equal("string", nameGetterCapability.ReturnType?.
TypeId
);
162
Assert.Equal("Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", nameSetterCapability.ReturnType?.
TypeId
); // Returns context for fluent chaining
170
Assert.Equal("number", valueGetterCapability.ReturnType?.
TypeId
);
253
t.
TypeId
== "Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource");
390
c.ExpandedTargetTypes.Any(t => t.
TypeId
.Contains("ContainerResource")))
395
TargetType = c.TargetType != null ? new { c.TargetType.
TypeId
, c.TargetType.IsInterface } : null,
397
.Where(t => t.
TypeId
.Contains("ContainerResource"))
398
.Select(t => new { t.
TypeId
, t.IsInterface })
438
if (expandedType.
TypeId
.Contains("ContainerResource"))
441
$"Capability '{cap.CapabilityId}' ExpandedTargetType '{expandedType.
TypeId
}' has IsInterface = true");
464
Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", withBindMount.TargetType.
TypeId
);
493
Assert.Contains("IResourceWithConnectionString", withConnectionStringDirect.TargetType.
TypeId
);
501
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
521
Assert.Contains("TestRedisResource", withRedisSpecific.TargetType.
TypeId
);
529
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
547
Assert.Contains("ContainerResource", withBindMount.TargetType.
TypeId
);
555
.FirstOrDefault(t => t.
TypeId
.Contains("ContainerResource") && !t.
TypeId
.Contains("IContainer"));
653
$"Expanded type '{expandedType.
TypeId
}' should be a concrete type, not an interface");
677
Assert.Contains("IResourceWithEnvironment", testWithEnvironmentCallback.TargetType.
TypeId
);
686
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
802
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
987
Assert.Equal("any", valueParam.Type.
TypeId
);
1134
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.
TypeId
);
1169
Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.
TypeId
);
1188
Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.
TypeId
);
1192
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.
TypeId
);
1419
var expandedTypeIds = withNpm.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
1450
var expandedTypeIds = capability.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
Aspire.Hosting.RemoteHost (26)
Ats\AtsMarshaller.cs (5)
138
if (typeRef.
TypeId
== AtsConstants.CancellationToken && value is CancellationToken cancellationToken)
144
if (typeRef.
TypeId
== TypeSystem.AtsConstants.Any)
151
AtsTypeCategory.Handle => _handles.Marshal(value, typeRef.
TypeId
),
156
AtsTypeCategory.List => _handles.Marshal(value, typeRef.
TypeId
),
157
AtsTypeCategory.Dict => _handles.Marshal(value, typeRef.
TypeId
),
AtsCapabilityScanner.cs (20)
551
enumTypes.TryAdd(typeRef.
TypeId
, typeRef.ClrType);
603
if (typeRef.Category == AtsTypeCategory.Unknown && validTypes.Contains(typeRef.
TypeId
))
700
return typeRef.
TypeId
;
807
AddToCompatibilityMap(typeToCompatibleTypes, iface.
TypeId
, concreteTypeRef);
813
AddToCompatibilityMap(typeToCompatibleTypes, baseType.
TypeId
, concreteTypeRef);
846
.SelectMany(c => c.ExpandedTargetTypes.Select(t => (Target: t.
TypeId
, Capability: c)))
1104
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
1110
propertyTypeId = propertyTypeRef.
TypeId
;
1123
propertyTypeId = propertyTypeRef.
TypeId
;
1128
propertyTypeId = propertyTypeRef.
TypeId
;
1456
var firstParamTypeId = extendsTypeRef?.
TypeId
?? MapToAtsTypeId(firstParamType, assemblyExportedTypeCache);
2096
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2119
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2141
TypeId = AtsConstants.ListTypeId(elementTypeRef.
TypeId
),
2161
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2220
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2633
TypeId = string.Join("|", unionTypes.Select(u => u.
TypeId
)),
CodeGeneration\CodeGenerationService.cs (1)
97
TypeId = t.
TypeId
,
Aspire.Hosting.RemoteHost.Tests (3)
AtsCapabilityScannerTests.cs (3)
141
Assert.Equal("string[]", itemsType.
TypeId
);
146
Assert.Equal("string[]", enumerableReturnCapability.ReturnType.
TypeId
);
348
Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(AssemblyLevelExportedTestType)), parameter.Type.
TypeId
);