Guerrilla
Guerrilla

Reputation: 14926

Add additional types to DTO

I have a few classes on backend that I am not using in any DTOs but I would like to export to my DTO typescript file.

I tried adding them to IncludeTypes field but then only those types explicitly defined are exported.

Is there any way I can export all my DTO classes and specify some additional classes to export?

Upvotes: 1

Views: 44

Answers (1)

mythz
mythz

Reputation: 143399

ServiceStack only exports Types in your Service Contract. The easiest way would be to add a DummyTypes Service holding the Types you want to export, e.g:

public class ExportTypes
{
    public MyType1 MyType1 { get; set; }
    public MyType2 MyType2 { get; set; }
}

public class ExportTypesService : Service 
{
    public object Any(ExportTypes request) => request;
}

Upvotes: 1

Related Questions