Skip to main content

Create DTOs

Creates Data Transfer Objects (DTOs) for a specific entity in the .NET application.

Event Name

CreateDTOs

Event Params

export interface CreateDTOsParams extends EventParams {
entity: Entity;
dtoName: string;
dtoBasePath: string;
}

Example

afterCreateDTOs(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateDTOsParams,
files: FileMap<Class>
): Promise<FileMap<Class>> {
const { entity, dtoName } = eventParams;
const dtoFile = files.get(`DTOs/${dtoName}.cs`);
if (dtoFile) {
dtoFile.code.addProperty(
CsharpSupport.property({
name: "LastModified",
type: CsharpSupport.Types.dateTime(),
})
);
}
return files;
}