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 Program File
Creates the main Program.cs file for the .NET application.
beforeCreateProgramFile(
{ resourceInfo }: dotnetTypes.DsgContext,
eventParams: dotnet.CreateProgramFileParams
) {
const serviceNamespace = pascalCase(resourceInfo?.name ?? "");
const serviceDbContext = `${pascalCase(resourceInfo?.name ?? "")}DbContext`;
eventParams.builderServicesBlocks.push(
new CodeBlock({
code: `builder.Services.AddDbContext<${serviceDbContext}>(opt => opt.UseNpgsql(builder.Configuration.GetConnectionString("${CONNECTION_STRING}")));`,
references: [
new ClassReference({
name: "AddDbContext",
namespace: "Microsoft.EntityFrameworkCore",
}),
new ClassReference({
name: serviceDbContext,
namespace: `${serviceNamespace}.Infrastructure`,
}),
],
})
);
return eventParams;
}
Event Name
CreateProgramFile
Event Parameters
An array of code blocks to be added to the builder.Services
section in Program.cs
.
An array of code blocks to be added to the application configuration section in Program.cs
.
beforeCreateProgramFile(
{ resourceInfo }: dotnetTypes.DsgContext,
eventParams: dotnet.CreateProgramFileParams
) {
const serviceNamespace = pascalCase(resourceInfo?.name ?? "");
const serviceDbContext = `${pascalCase(resourceInfo?.name ?? "")}DbContext`;
eventParams.builderServicesBlocks.push(
new CodeBlock({
code: `builder.Services.AddDbContext<${serviceDbContext}>(opt => opt.UseNpgsql(builder.Configuration.GetConnectionString("${CONNECTION_STRING}")));`,
references: [
new ClassReference({
name: "AddDbContext",
namespace: "Microsoft.EntityFrameworkCore",
}),
new ClassReference({
name: serviceDbContext,
namespace: `${serviceNamespace}.Infrastructure`,
}),
],
})
);
return eventParams;
}
Was this page helpful?
beforeCreateProgramFile(
{ resourceInfo }: dotnetTypes.DsgContext,
eventParams: dotnet.CreateProgramFileParams
) {
const serviceNamespace = pascalCase(resourceInfo?.name ?? "");
const serviceDbContext = `${pascalCase(resourceInfo?.name ?? "")}DbContext`;
eventParams.builderServicesBlocks.push(
new CodeBlock({
code: `builder.Services.AddDbContext<${serviceDbContext}>(opt => opt.UseNpgsql(builder.Configuration.GetConnectionString("${CONNECTION_STRING}")));`,
references: [
new ClassReference({
name: "AddDbContext",
namespace: "Microsoft.EntityFrameworkCore",
}),
new ClassReference({
name: serviceDbContext,
namespace: `${serviceNamespace}.Infrastructure`,
}),
],
})
);
return eventParams;
}