Interface IToPresentDto
Interface for converting objects to presentation DTOs (Data Transfer Objects) for JSON serialization.
public interface IToPresentDto
- Extension Methods
Remarks
Implementations must not return anonymous types: release assemblies are obfuscated
with only the public API kept, so an anonymous type gets renamed and loses its
constructor parameter names, which makes System.Text.Json throw
NotSupportedException when serializing it. Return a
Dictionary<string, object> instead — its keys are emitted verbatim as
the JSON property names. Key by nameof of the mirrored member where one
exists (nameof compiles to a string literal, so obfuscation cannot touch
it); use a literal for marker keys such as “Type”.
Methods
ToPresentDto()
Convert to presentation DTO (Data Transfer Object) for JSON serialization. The returned object includes type metadata for web API presentation.
object ToPresentDto()
Returns
- object
DTO object with type and object properties