.NET Plugin Events
Create Seed Development Data File
Get Started
Lifecycle & Coding Details
Developing a Plugin
Guides & Tutorials
Blueprint Plugin Events
Node.js Plugin Events
- Create Server
- Create Server Docker Compose
- Create Server Docker Compose Dev
- Create Server Dot Env
- Create Server Auth
- Create Package Json
- Create Entity Service
- Create Entity Service Base
- Create Entity Controller
- Create Entity Controller Base
- Create Entity Resolver
- Create Entity Resolver Base
- Create Message Broker Service
- Create Message Broker Service Base
- Create Message Broker NestJS Module
- Create Message Broker Client Options Factory
- Create Message Broker Topics Enum
- Create Prisma Schema
.NET Plugin Events
- Create Server
- Create Server Appsettings
- Create Server Auth
- Create Program File
- Create Server Csproj
- Create Server Docker Compose
- Create Server Git Ignore
- Create Entity Model
- Create Resource Db Context File
- Create Message Broker
- Create Message Broker Client Options Factory
- Create Message Broker Service
- Create Entity Controller
- Create Entity Controller Base
- Create DTOs
- Create Entity Extensions
- Create Entity Interface
- Create Entity Service
- Create Entity Service Base
- Create Seed Development Data File
- Load Static Files
.NET Plugin Events
Create Seed Development Data File
Creates a file for seeding development data in the .NET application.
afterCreateSeedDevelopmentDataFile(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateSeedDevelopmentDataFileParams,
files: FileMap<Class>
): FileMap<Class> {
const { seedFilePath, resourceName } = eventParams;
const { entities } = context;
if (!entities) return files;
const seedFile = files.get(seedFilePath);
seedFile?.code.addMethod(
CsharpSupport.method({
name: "SeedDevUser",
access: "public",
isAsync: true,
body: CreateSeedDevelopmentDataBody(resourceName, context),
type: MethodType.STATIC,
parameters: [
CsharpSupport.parameter({
name: "serviceProvider",
type: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: "IServiceProvider",
namespace: `${resourceName}.Infrastructure.Models`,
})
),
}),
CsharpSupport.parameter({
name: "configuration",
type: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: "IConfiguration",
namespace: "",
})
),
}),
],
})
);
return files;
}
Event Name
CreateSeedDevelopmentDataFile
Event Parameters
The full path to the seed development data file being created.
The name of the resource (typically the application name).
afterCreateSeedDevelopmentDataFile(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateSeedDevelopmentDataFileParams,
files: FileMap<Class>
): FileMap<Class> {
const { seedFilePath, resourceName } = eventParams;
const { entities } = context;
if (!entities) return files;
const seedFile = files.get(seedFilePath);
seedFile?.code.addMethod(
CsharpSupport.method({
name: "SeedDevUser",
access: "public",
isAsync: true,
body: CreateSeedDevelopmentDataBody(resourceName, context),
type: MethodType.STATIC,
parameters: [
CsharpSupport.parameter({
name: "serviceProvider",
type: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: "IServiceProvider",
namespace: `${resourceName}.Infrastructure.Models`,
})
),
}),
CsharpSupport.parameter({
name: "configuration",
type: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: "IConfiguration",
namespace: "",
})
),
}),
],
})
);
return files;
}
Was this page helpful?
afterCreateSeedDevelopmentDataFile(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateSeedDevelopmentDataFileParams,
files: FileMap<Class>
): FileMap<Class> {
const { seedFilePath, resourceName } = eventParams;
const { entities } = context;
if (!entities) return files;
const seedFile = files.get(seedFilePath);
seedFile?.code.addMethod(
CsharpSupport.method({
name: "SeedDevUser",
access: "public",
isAsync: true,
body: CreateSeedDevelopmentDataBody(resourceName, context),
type: MethodType.STATIC,
parameters: [
CsharpSupport.parameter({
name: "serviceProvider",
type: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: "IServiceProvider",
namespace: `${resourceName}.Infrastructure.Models`,
})
),
}),
CsharpSupport.parameter({
name: "configuration",
type: CsharpSupport.Types.reference(
CsharpSupport.classReference({
name: "IConfiguration",
namespace: "",
})
),
}),
],
})
);
return files;
}