Skip to main content

Create Entity Interface

Creates an interface for entities in the .NET application.

Event Name

CreateEntityInterface

Event Params

export interface CreateEntityInterfaceParams extends EventParams {
entity: Entity;
resourceName: string;
apisDir: string;
moduleContainers: ModuleContainer[];
moduleActions: ModuleAction[];
entities: Entity[];
}

Example

afterCreateEntityInterface(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateEntityInterfaceParams,
files: FileMap<Interface>
): Promise<FileMap<Interface>> {
const { entity } = eventParams;
const interfaceFile = files.get(`Interfaces/I${entity.name}.cs`);
if (interfaceFile) {
interfaceFile.code.addMethod(
CsharpSupport.method({
name: "Validate",
returnType: CsharpSupport.Types.boolean(),
})
);
}
return files;
}