AspireDtoAttribute
Classsealednet10.0
Marks a class as an ATS (Aspire Type System) Data Transfer Object. DTOs are serializable types used to pass structured data to capabilities.
namespace Aspire.Hosting;
public sealed class AspireDtoAttribute : System.Attribute{ // ...}Attribute
Remarks
Section titled RemarksDTOs should be simple record or class types with properties that can be serialized to/from JSON. They should not contain complex .NET types like IConfiguration, ILogger, or other framework-specific types.
Example: [AspireDto]public sealed class AddRedisOptions { public required string Name { get; init; } public int? Port { get; init; }}
Constructors1
Section titled ConstructorsProperties1
Section titled PropertiesDtoTypeIdget; setstring? Gets or sets an optional type identifier for this DTO. If not specified, the DTO will be serialized as a plain JSON object.