Documentation Index
Fetch the complete documentation index at: https://docs.amplication.com/llms.txt
Use this file to discover all available pages before exploring further.
Event Name
CreateResourceDbContextFile
Event Parameters
An array of all entities in the application.
The name of the resource (typically the entity name).
The path where the database context file will be created.
afterCreateResourceDbContextFile(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateResourceDbContextFileParams,
files: FileMap<Class>
): FileMap<Class> {
const { resourceDbContextPath, resourceName } = eventParams;
const modelFile = files.get(
`${resourceDbContextPath}${resourceName}DbContext.cs`
);
if (!modelFile) return files;
modelFile.code.parentClassReference = CsharpSupport.genericClassReference({
reference: CsharpSupport.classReference({
name: `IdentityDbContext`,
namespace: "Microsoft.AspNetCore.Identity.EntityFrameworkCore",
}),
innerType: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: `IdentityUser`,
namespace: "Microsoft.AspNetCore.Identity",
})
),
});
return files;
}