304 references to AtsConstants
Aspire.Hosting.CodeGeneration.Go (37)
AtsGoCodeGenerator.cs (37)
137if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 151if (handleType.AtsTypeId == AtsConstants.ReferenceExpressionTypeId 315if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 536if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 922if (string.Equals(typeId, AtsConstants.BuilderTypeId, StringComparison.Ordinal)) 924var appInterface = _interfaceNames.TryGetValue(AtsConstants.ApplicationTypeId, out var appName) 1147&& p.CallbackReturnType.TypeId != AtsConstants.Void; 1164var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 1557&& p.CallbackReturnType.TypeId != AtsConstants.Void; 1908var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 1932WriteLine("\tc.registerHandleWrapper(\"" + AtsConstants.ReferenceExpressionTypeId + "\", func(h *handle, c *client) any {"); 1950var builderTypeId = AtsConstants.BuilderTypeId; 1957var appTypeId = AtsConstants.ApplicationTypeId; 2007WriteLine($"\tresult, err := b.client.invokeCapability(context.Background(), \"{AtsConstants.BuildCapability}\", map[string]any{{"); 2065WriteLine($"\tresult, err := c.invokeCapability(context.Background(), \"{AtsConstants.CreateBuilderCapability}\", map[string]any{{\"argsOrOptions\": resolved}})"); 2098if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2136if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2166&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 2189AtsConstants.String or AtsConstants.Char => "string", 2190AtsConstants.Number => "float64", 2191AtsConstants.Boolean => "bool", 2192AtsConstants.Void => "", 2193AtsConstants.Any => "any", 2194AtsConstants.DateTime or AtsConstants.DateTimeOffset or 2195AtsConstants.DateOnly or AtsConstants.TimeOnly => "string", 2196AtsConstants.TimeSpan => "float64", 2197AtsConstants.Guid or AtsConstants.Uri => "string", 2198AtsConstants.CancellationToken => "*CancellationToken", 2208string.Equals(capabilityId, AtsConstants.BuildCapability, StringComparison.Ordinal) 2209|| string.Equals(capabilityId, AtsConstants.CreateBuilderCapability, StringComparison.Ordinal); 2215string.Equals(typeId, AtsConstants.CancellationToken, StringComparison.Ordinal)
Aspire.Hosting.CodeGeneration.Java (41)
AtsJavaCodeGenerator.cs (41)
717if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 1317var builderClassName = _classNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) 1875var hasReturn = capability.ReturnType?.TypeId != AtsConstants.Void; 1890var hasReturnType = callbackReturnType != null && callbackReturnType.TypeId != AtsConstants.Void; 1924var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; 1980var hasReturnType = property.CallbackReturnType != null && property.CallbackReturnType.TypeId != AtsConstants.Void; 2010if (callbackParameter.Type?.TypeId == AtsConstants.CancellationToken) 2030if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2152AtsConstants.String or AtsConstants.Char or 2153AtsConstants.DateTime or AtsConstants.DateTimeOffset or 2154AtsConstants.DateOnly or AtsConstants.TimeOnly or 2155AtsConstants.Guid or AtsConstants.Uri => $"(String) {valueExpression}", 2156AtsConstants.Number or AtsConstants.TimeSpan => $"((Number) {valueExpression}).doubleValue()", 2157AtsConstants.Boolean => $"(Boolean) {valueExpression}", 2158AtsConstants.Void => "null", 2209if (typeRef.TypeId == AtsConstants.CancellationToken) 2319var builderClassName = _classNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) 2398if (handleType.AtsTypeId == AtsConstants.ReferenceExpressionTypeId 2549if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2581if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2639AtsConstants.String or AtsConstants.Char => "String", 2648AtsConstants.Number => useBoxedTypes ? "Number" : "double", 2649AtsConstants.Boolean => useBoxedTypes ? "Boolean" : "boolean", 2650AtsConstants.Void => "void", 2651AtsConstants.Any => "Object", 2652AtsConstants.DateTime or AtsConstants.DateTimeOffset or 2653AtsConstants.DateOnly or AtsConstants.TimeOnly => "String", 2654AtsConstants.TimeSpan => useBoxedTypes ? "Number" : "double", 2655AtsConstants.Guid or AtsConstants.Uri => "String", 2656AtsConstants.CancellationToken => "CancellationToken", 2666string.Equals(typeId, AtsConstants.CancellationToken, StringComparison.Ordinal) 2677if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId
Aspire.Hosting.CodeGeneration.Java.Tests (17)
AtsJavaCodeGeneratorTests.cs (17)
2724var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2733CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2740ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2765Type = new AtsTypeRef { TypeId = AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto } 2772ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2807TypeId = AtsConstants.Number, 2841new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }), 2845new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true })); 2966TypeId = AtsConstants.Number, 2972TypeId = AtsConstants.Boolean, 3004CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3011ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3235Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3256TypeId = AtsConstants.Void, 3321CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3328ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3350Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python (24)
AtsPythonCodeGenerator.cs (24)
148AtsConstants.ReferenceExpressionTypeId, 247&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 254AtsConstants.String or AtsConstants.Char => "str", 255AtsConstants.Number => "int", 256AtsConstants.Boolean => "bool", 257AtsConstants.Void => "None", 258AtsConstants.Any => "typing.Any", 259AtsConstants.DateTime => "datetime.datetime", 260AtsConstants.DateTimeOffset => "datetime.datetime", 261AtsConstants.DateOnly => "datetime.date", 262AtsConstants.TimeOnly => "datetime.time", 263AtsConstants.TimeSpan => "float", 264AtsConstants.Guid or AtsConstants.Uri => "str", 265AtsConstants.CancellationToken => "CancellationToken", 275if (param.Type?.TypeId == AtsConstants.CancellationToken) 288if (param.Type?.TypeId == AtsConstants.CancellationToken) 454filtered = filtered.Where(p => p.Type?.TypeId != AtsConstants.CancellationToken); 466if (param.Type?.TypeId == AtsConstants.CancellationToken) 528if (typeRef.Category == AtsTypeCategory.Primitive && typeRef.TypeId == AtsConstants.Void) 661if (param.Type?.TypeId == AtsConstants.CancellationToken)
Aspire.Hosting.CodeGeneration.Python.Tests (9)
AtsPythonCodeGeneratorTests.cs (9)
523TypeId = AtsConstants.String, 579TypeId = AtsConstants.String, 653TypeId = AtsConstants.Void, 705TypeId = AtsConstants.Number, 713TypeId = AtsConstants.String, 752TypeId = AtsConstants.Number, 762TypeId = AtsConstants.Void, 798TypeId = AtsConstants.String, 804TypeId = AtsConstants.Boolean,
Aspire.Hosting.CodeGeneration.Rust (43)
AtsRustCodeGenerator.cs (43)
207if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 375if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 472var hasReturn = capability.ReturnType.TypeId != AtsConstants.Void; 609else if (returnTypeRef?.TypeId == AtsConstants.CancellationToken) 713var builderStructName = _structNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) 781if (handleType.AtsTypeId == AtsConstants.ReferenceExpressionTypeId 905if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 943if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 983if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 1013AtsConstants.String or AtsConstants.Char => "String", 1014AtsConstants.Number => "f64", 1015AtsConstants.Boolean => "bool", 1016AtsConstants.Void => "()", 1017AtsConstants.Any => "Value", 1018AtsConstants.DateTime or AtsConstants.DateTimeOffset or 1019AtsConstants.DateOnly or AtsConstants.TimeOnly => "String", 1020AtsConstants.TimeSpan => "f64", 1021AtsConstants.Guid or AtsConstants.Uri => "String", 1022AtsConstants.CancellationToken => "CancellationToken", 1039AtsConstants.String or AtsConstants.Char => "&str", 1040AtsConstants.Number => "f64", 1041AtsConstants.Boolean => "bool", 1042AtsConstants.Void => "()", 1043AtsConstants.Any => "&Value", 1044AtsConstants.DateTime or AtsConstants.DateTimeOffset or 1045AtsConstants.DateOnly or AtsConstants.TimeOnly => "&str", 1046AtsConstants.TimeSpan => "f64", 1047AtsConstants.Guid or AtsConstants.Uri => "&str", 1048AtsConstants.CancellationToken => "&CancellationToken", 1062&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 1066&& typeRef.TypeId != AtsConstants.ReferenceExpressionTypeId 1084string.Equals(typeId, AtsConstants.CancellationToken, StringComparison.Ordinal) 1095if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId
Aspire.Hosting.CodeGeneration.TypeScript (36)
AtsTypeScriptCodeGenerator.cs (14)
134capability.ReturnType.TypeId == AtsConstants.Void ? null : capability.Documentation?.Returns, 135suppressReturns: capability.ReturnType.TypeId == AtsConstants.Void, 914var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 1191if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 1775else if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 1853&& callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; 1890if (cbTypeId == AtsConstants.CancellationToken) 1917var builderHandle = TypeScriptApiProjector.GetHandleTypeName(AtsConstants.BuilderTypeId); 2241if (getter.ReturnType?.TypeId == AtsConstants.CancellationToken) 2321if (getter.ReturnType?.TypeId == AtsConstants.CancellationToken) 2670else if (method.ReturnType?.TypeId == AtsConstants.CancellationToken) 2858var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 3000if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 3065var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void;
TypeScriptApiProjector.cs (22)
424if (capability.ReturnType is null || capability.ReturnType.TypeId == AtsConstants.Void) 1659if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 1711return typeRef.TypeId is AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken 1760AtsConstants.String or AtsConstants.Char => "string", 1761AtsConstants.Number => "number", 1762AtsConstants.Boolean => "boolean", 1763AtsConstants.Void => "void", 1764AtsConstants.Any => "any", 1765AtsConstants.DateTime or AtsConstants.DateTimeOffset or 1766AtsConstants.DateOnly or AtsConstants.TimeOnly => "string", 1767AtsConstants.TimeSpan => "number", 1768AtsConstants.Guid or AtsConstants.Uri => "string", 1769AtsConstants.CancellationToken => GetCancellationTokenInterfaceName(), 2007internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.TypeId == AtsConstants.CancellationToken; 2670if (targetTypeId is AtsConstants.ReferenceExpressionTypeId or InteractionInputCollectionTypeId) 3107var returnType = callbackReturnType == null || callbackReturnType.TypeId == AtsConstants.Void
Aspire.Hosting.CodeGeneration.TypeScript.Tests (17)
AtsTypeScriptCodeGeneratorTests.cs (17)
784TypeId = AtsConstants.Number, 790TypeId = $"{AtsConstants.Number}[]", 1639TypeId = AtsConstants.Void, 1662TypeId = AtsConstants.Void, 1947c.TargetTypeId == AtsConstants.ReferenceExpressionTypeId); 2039Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.TypeId); 2074Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.TypeId); 2093Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.TypeId); 2097Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.TypeId); 2570TypeId = AtsConstants.String, 2575TypeId = AtsConstants.Void, 2879TypeId = AtsConstants.Void, 3012TypeId = AtsConstants.Void, 3019TypeId = AtsConstants.Void, 3046TypeId = AtsConstants.String, 3055TypeId = AtsConstants.Number, 3063TypeId = AtsConstants.Void,
Aspire.Hosting.RemoteHost (53)
Ats\AtsMarshaller.cs (2)
144if (typeRef.TypeId == AtsConstants.CancellationToken && value is CancellationToken cancellationToken) 150if (typeRef.TypeId == TypeSystem.AtsConstants.Any)
AtsCapabilityScanner.cs (50)
98var typeId = AtsConstants.EnumTypeId(fullName); 1312AtsTypeCategory.Primitive => typeRef.TypeId != AtsConstants.CancellationToken && typeRef.TypeId != AtsConstants.Void, 1617: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1621TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 1644propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2207returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2211returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2219?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2220: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2225?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2253var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2371if (AtsConstants.IsPrimitiveType(type)) 2379return AtsConstants.Any; 2384return AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any); 2389return AtsConstants.ListTypeId(AtsConstants.Any); 2395return AtsConstants.EnumTypeId(type.FullName ?? type.Name); 2417return AtsConstants.DictTypeId(keyTypeName, valueTypeName); 2433return AtsConstants.ListTypeId(elementTypeName); 2504return AtsConstants.String; 2508return AtsConstants.Char; 2512return AtsConstants.Boolean; 2521return AtsConstants.Number; 2527return AtsConstants.DateTime; 2531return AtsConstants.DateTimeOffset; 2535return AtsConstants.DateOnly; 2539return AtsConstants.TimeOnly; 2543return AtsConstants.TimeSpan; 2549return AtsConstants.Guid; 2553return AtsConstants.Uri; 2557return AtsConstants.CancellationToken; 2588TypeId = AtsConstants.Void, 2689return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2696TypeId = AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any), 2699KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2700ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2709TypeId = AtsConstants.ListTypeId(AtsConstants.Any), 2712ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2724TypeId = AtsConstants.EnumTypeId(type.FullName ?? type.Name), 2747TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2770TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2792TypeId = AtsConstants.ListTypeId(elementTypeRef.TypeId), 2812TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2857TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
AtsContextFilter.cs (1)
343TypeId = AtsConstants.Void,
Aspire.Hosting.RemoteHost.Tests (25)
AtsCapabilityScannerTests.cs (9)
169[InlineData(typeof(double?[]), AtsConstants.Number)] 170[InlineData(typeof(bool?[]), AtsConstants.Boolean)] 193Assert.Contains(parameter.Type.UnionTypes!, type => type.TypeId == AtsConstants.String); 457Assert.Equal(AtsConstants.String, nameGetter.ReturnType.TypeId); 462Assert.Equal(AtsConstants.String, descriptionGetter.ReturnType.TypeId); 483Assert.Equal(AtsConstants.String, nullableString.Type.TypeId); 488Assert.Equal(AtsConstants.String, requiredString.Type.TypeId); 493Assert.Equal(AtsConstants.Number, nullableNumber.Type.TypeId); 498Assert.Equal(AtsConstants.Number, requiredNumber.Type.TypeId);
AtsContextFilterTests.cs (11)
136type => Assert.Equal(AtsConstants.EnumTypeId(typeof(TestMode).FullName!), type.TypeId)); 163Assert.Contains(filteredContext.EnumTypes, type => type.TypeId == AtsConstants.EnumTypeId(typeof(DistributedApplicationOperation).FullName!)); 164Assert.Contains(filteredContext.EnumTypes, type => type.TypeId == AtsConstants.EnumTypeId("Aspire.TypeSystem.ExportedValueMode")); 231Assert.Equal(AtsConstants.Void, filteredSupport.ReturnType.TypeId); 248TypeId = AtsConstants.EnumTypeId("Some.Foreign.Dependency.ForeignMode"), 256TypeId = AtsConstants.EnumTypeId("Some.Foreign.Dependency.ForeignCallbackMode"), 285Type = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 434TypeId = AtsConstants.EnumTypeId(typeof(TestMode).FullName!), 453TypeId = AtsConstants.EnumTypeId(typeof(TestMode).FullName!), 461TypeId = AtsConstants.EnumTypeId("Aspire.TypeSystem.ExportedValueMode"), 469TypeId = AtsConstants.EnumTypeId(typeof(DistributedApplicationOperation).FullName!),
AtsMarshallerTests.cs (4)
225TypeId = AtsConstants.CancellationToken, 1326var conditionHandleId = registry.Register(condition, AtsConstants.ReferenceExpressionTypeId); 1368var conditionHandleId = registry.Register(condition, AtsConstants.ReferenceExpressionTypeId); 1410var conditionHandleId = registry.Register(condition, AtsConstants.ReferenceExpressionTypeId);
HandleRegistryTests.cs (1)
355var typeId = AtsConstants.ReferenceExpressionTypeId;
Aspire.TypeSystem (2)
AtsCapabilityInfo.cs (1)
309/// Use <see cref="AtsConstants.Void"/> TypeId for void return types.
AtsContext.cs (1)
110if (AtsConstants.IsPrimitiveType(type))