32 writes to TypeId
Aspire.Hosting (31)
Ats\AtsCapabilityScanner.cs (31)
753
TypeId
= originalTarget,
783
TypeId
= typeInfo.AtsTypeId,
1080
: new AtsTypeRef {
TypeId
= AtsConstants.Any, Category = AtsTypeCategory.Primitive };
1084
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
1107
propertyTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Any, Category = AtsTypeCategory.Primitive };
1126
TypeId
= typeId,
1232
TypeId
= typeId,
1547
? new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback }
1600
returnTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1604
returnTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1612
?? new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
1613
: new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1618
?? new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1644
var voidTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
1961
TypeId
= AtsConstants.Void,
2028
return new AtsTypeRef {
TypeId
= primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive };
2034
return new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive };
2045
TypeId
= AtsConstants.EnumTypeId(type.FullName ?? type.Name),
2068
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2091
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2113
TypeId
= AtsConstants.ListTypeId(elementTypeRef.TypeId),
2133
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2161
TypeId
= constraintTypeId,
2172
TypeId
= typeId,
2192
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2208
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2220
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2230
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2310
TypeId
= ifaceTypeId,
2345
TypeId
= baseTypeId,
2604
TypeId
= string.Join("|", unionTypes.Select(u => u.TypeId)),
Aspire.Hosting.RemoteHost.Tests (1)
AtsMarshallerTests.cs (1)
682
var typeRef = new AtsTypeRef {
TypeId
= "test/SelfReferencingDto", Category = AtsTypeCategory.Dto };
179 references to TypeId
Aspire.Hosting (20)
Ats\AtsCapabilityScanner.cs (20)
540
enumTypes.TryAdd(typeRef.
TypeId
, typeRef.ClrType);
592
if (typeRef.Category == AtsTypeCategory.Unknown && validTypes.Contains(typeRef.
TypeId
))
689
return typeRef.
TypeId
;
796
AddToCompatibilityMap(typeToCompatibleTypes, iface.
TypeId
, concreteTypeRef);
802
AddToCompatibilityMap(typeToCompatibleTypes, baseType.
TypeId
, concreteTypeRef);
835
.SelectMany(c => c.ExpandedTargetTypes.Select(t => (Target: t.
TypeId
, Capability: c)))
1084
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
1090
propertyTypeId = propertyTypeRef.
TypeId
;
1103
propertyTypeId = propertyTypeRef.
TypeId
;
1108
propertyTypeId = propertyTypeRef.
TypeId
;
1435
var firstParamTypeId = extendsTypeRef?.
TypeId
?? MapToAtsTypeId(firstParamType);
2068
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2091
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2113
TypeId = AtsConstants.ListTypeId(elementTypeRef.
TypeId
),
2133
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2192
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2604
TypeId = string.Join("|", unionTypes.Select(u => u.
TypeId
)),
Aspire.Hosting.CodeGeneration.Go (15)
AtsGoCodeGenerator.cs (15)
296
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
611
if (targetType.
TypeId
is null)
616
if (!result.TryGetValue(targetType.
TypeId
, out var list))
619
result[targetType.
TypeId
] = list;
661
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
668
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
669
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
670
AtsTypeCategory.Handle => "*" + MapHandleType(typeRef.
TypeId
),
671
AtsTypeCategory.Dto => "*" + MapDtoType(typeRef.
TypeId
),
714
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
728
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
729
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
736
handleTypeIds.Add(typeRef.
TypeId
);
751
typeIds[typeRef.
TypeId
] = false; // false = List
758
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Go.Tests (2)
AtsGoCodeGeneratorTests.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.Java (15)
AtsJavaCodeGenerator.cs (15)
276
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
578
if (targetType.
TypeId
is null)
583
if (!result.TryGetValue(targetType.
TypeId
, out var list))
586
result[targetType.
TypeId
] = list;
626
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
633
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
, isOptional),
634
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
635
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
636
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
678
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
692
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
693
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
700
handleTypeIds.Add(typeRef.
TypeId
);
715
typeIds[typeRef.
TypeId
] = false; // false = List
722
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Java.Tests (2)
AtsJavaCodeGeneratorTests.cs (2)
81
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
199
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.Python (13)
AtsPythonCodeGenerator.cs (13)
290
if (capability.ReturnType.
TypeId
== AtsConstants.Void)
483
if (targetType.
TypeId
is null)
488
if (!result.TryGetValue(targetType.
TypeId
, out var list))
491
result[targetType.
TypeId
] = list;
577
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
584
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
585
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
586
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
587
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
652
parameter.Type?.
TypeId
== AtsConstants.CancellationToken;
663
handleTypeIds.Add(typeRef.
TypeId
);
678
typeIds[typeRef.
TypeId
] = false; // false = List
685
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Python.Tests (2)
AtsPythonCodeGeneratorTests.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.Rust (23)
AtsRustCodeGenerator.cs (23)
322
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
455
var wrappedType = MapHandleType(returnTypeRef.
TypeId
);
459
else if (returnTypeRef?.
TypeId
== AtsConstants.CancellationToken)
686
if (targetType.
TypeId
is null)
691
if (!result.TryGetValue(targetType.
TypeId
, out var list))
694
result[targetType.
TypeId
] = list;
733
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
740
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
741
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
742
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
743
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
771
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
778
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
779
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
782
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
830
var baseType = typeRef.
TypeId
switch
854
&& typeRef.
TypeId
!= AtsConstants.ReferenceExpressionTypeId
855
&& !IsCancellationTokenTypeId(typeRef.
TypeId
);
869
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
883
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
884
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
891
handleTypeIds.Add(typeRef.
TypeId
);
906
typeIds.Add(typeRef.
TypeId
);
Aspire.Hosting.CodeGeneration.Rust.Tests (2)
AtsRustCodeGeneratorTests.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.TypeScript (48)
AtsTypeScriptCodeGenerator.cs (48)
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
),
284
private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.
TypeId
;
388
if (IsHandleType(cap.ReturnType) && !dtoTypeIds.Contains(cap.ReturnType!.
TypeId
))
395
if (IsHandleType(param.Type) && !dtoTypeIds.Contains(param.Type!.
TypeId
))
397
typeIds.Add(param.Type!.
TypeId
);
404
if (IsHandleType(cbParam.Type) && !dtoTypeIds.Contains(cbParam.Type.
TypeId
))
406
typeIds.Add(cbParam.Type.
TypeId
);
799
var aTypeId = a.Type?.
TypeId
;
800
var bTypeId = b.Type?.
TypeId
;
824
if (!string.Equals(aCallbackParams[i].Type.
TypeId
, bCallbackParams[i].Type.
TypeId
, StringComparison.Ordinal))
831
var aReturnTypeId = a.CallbackReturnType?.
TypeId
;
832
var bReturnTypeId = b.CallbackReturnType?.
TypeId
;
967
if (capability.ReturnsBuilder && capability.ReturnType?.
TypeId
!= null &&
968
!string.Equals(capability.ReturnType.
TypeId
, builder.TypeId, StringComparison.Ordinal) &&
969
!string.Equals(capability.ReturnType.
TypeId
, capability.TargetTypeId, StringComparison.Ordinal))
971
returnTypeId = capability.ReturnType.
TypeId
;
1226
if (capability.ReturnsBuilder && capability.ReturnType?.
TypeId
!= null &&
1227
!string.Equals(capability.ReturnType.
TypeId
, builder.TypeId, StringComparison.Ordinal) &&
1228
!string.Equals(capability.ReturnType.
TypeId
, capability.TargetTypeId, StringComparison.Ordinal))
1230
var returnClass = _wrapperClassNames.GetValueOrDefault(capability.ReturnType.
TypeId
)
1231
?? DeriveClassName(capability.ReturnType.
TypeId
);
1364
var returnType = callbackReturnType == null || callbackReturnType.
TypeId
== AtsConstants.Void
1422
return param.Type?.
TypeId
== AtsConstants.CancellationToken;
1453
&& callbackParam.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1466
var cbTypeId = cbParam.Type.
TypeId
;
1496
var cbTypeId = cbParam.Type.
TypeId
;
1832
if (getter.ReturnType?.
TypeId
!= null && _wrapperClassNames.TryGetValue(getter.ReturnType.
TypeId
, out var wrapperClassName))
1883
var handleType = GetHandleTypeName(getter.ReturnType!.
TypeId
);
2211
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
2222
var returnWrapperClass = _wrapperClassNames.GetValueOrDefault(capability.ReturnType!.
TypeId
)
2223
?? DeriveClassName(capability.ReturnType.
TypeId
);
2224
var returnHandleType = GetHandleTypeName(capability.ReturnType.
TypeId
);
2408
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
2507
if (!capabilitiesByTypeId.TryGetValue(expandedType.
TypeId
, out var list))
2510
capabilitiesByTypeId[expandedType.
TypeId
] = list;
2512
typeRefsByTypeId[expandedType.
TypeId
] = expandedType;
2669
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Handle)
2671
typeRefs.TryAdd(typeRef.
TypeId
, typeRef);
2798
if (_typesWithPromiseWrappers.Contains(returnType.
TypeId
))
2800
var className = _wrapperClassNames.GetValueOrDefault(returnType.
TypeId
)
2801
?? DeriveClassName(returnType.
TypeId
);
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
105
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
142
Assert.Equal("string", nameGetterCapability.ReturnType?.
TypeId
);
152
Assert.Equal("Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", nameSetterCapability.ReturnType?.
TypeId
); // Returns context for fluent chaining
160
Assert.Equal("number", valueGetterCapability.ReturnType?.
TypeId
);
243
t.
TypeId
== "Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource");
380
c.ExpandedTargetTypes.Any(t => t.
TypeId
.Contains("ContainerResource")))
385
TargetType = c.TargetType != null ? new { c.TargetType.
TypeId
, c.TargetType.IsInterface } : null,
387
.Where(t => t.
TypeId
.Contains("ContainerResource"))
388
.Select(t => new { t.
TypeId
, t.IsInterface })
428
if (expandedType.
TypeId
.Contains("ContainerResource"))
431
$"Capability '{cap.CapabilityId}' ExpandedTargetType '{expandedType.
TypeId
}' has IsInterface = true");
454
Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", withBindMount.TargetType.
TypeId
);
483
Assert.Contains("IResourceWithConnectionString", withConnectionStringDirect.TargetType.
TypeId
);
491
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
511
Assert.Contains("TestRedisResource", withRedisSpecific.TargetType.
TypeId
);
519
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
537
Assert.Contains("ContainerResource", withBindMount.TargetType.
TypeId
);
545
.FirstOrDefault(t => t.
TypeId
.Contains("ContainerResource") && !t.
TypeId
.Contains("IContainer"));
643
$"Expanded type '{expandedType.
TypeId
}' should be a concrete type, not an interface");
667
Assert.Contains("IResourceWithEnvironment", testWithEnvironmentCallback.TargetType.
TypeId
);
676
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
780
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
930
Assert.Equal("any", valueParam.Type.
TypeId
);
1067
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.
TypeId
);
1100
Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.
TypeId
);
1119
Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.
TypeId
);
1123
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.
TypeId
);
1365
var expandedTypeIds = withNpm.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
1396
var expandedTypeIds = capability.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
Aspire.Hosting.RemoteHost (5)
Ats\AtsMarshaller.cs (4)
139
if (typeRef.
TypeId
== Hosting.Ats.AtsConstants.Any)
146
Hosting.Ats.AtsTypeCategory.Handle => _handles.Marshal(value, typeRef.
TypeId
),
151
Hosting.Ats.AtsTypeCategory.List => _handles.Marshal(value, typeRef.
TypeId
),
152
Hosting.Ats.AtsTypeCategory.Dict => _handles.Marshal(value, typeRef.
TypeId
),
CodeGeneration\CodeGenerationService.cs (1)
97
TypeId = t.
TypeId
,
Aspire.Hosting.Tests (2)
Ats\AtsCapabilityScannerTests.cs (2)
138
Assert.Equal("string[]", itemsType.
TypeId
);
143
Assert.Equal("string[]", enumerableReturnCapability.ReturnType.
TypeId
);