Skip to content
Docs Try Aspire

AspireDtoAttribute

Class sealed net8.0
📦 Aspire.Hosting v13.2.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

DTOs 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; }
}