Skip to content

Data

Use the task guide for the resource your application needs:

Resource Forge data access pattern
Oracle Database-first Entity Framework Core for existing schemas
Cosmos DB NoSQL Code-first Entity Framework Core for new application data
SQL Server Entity Framework Core supports code-first and database-first approaches; Forge has no SQL Server task guide here
Blob Storage Blob clients for file and object operations, not an EF provider

Database feature templates

The saif-feature-database-cosmosdb and saif-feature-database-oracle templates add a database to an existing project. Each guide lists its template-specific options and files; both templates share these conventions:

  • --name: your application name (for example, myapp). It replaces the template's SAIF.App1 placeholder in generated project and namespace names, so use the name your project was created with.
  • --project_id: your project identifier (for example, it-api-exp-myapp).
  • --force: overwrites existing files if they exist.
  • --skip_setup: skips the post-generation scripts/setup.<database>.ps1 script. Run pwsh scripts/setup.<database>.ps1 later to complete setup.

Both templates add the same project layout:

  • Data project (<name>.Data): the Entity Framework context, data models, and a generated service-registration extension.
  • Data.Seed project (<name>.Data.Seed): data seeding functionality.
  • Aspire resource builder (<name>.AppHost/ResourceBuilders/*ResourceBuilder.g.cs): the extension method that adds the database to your AppHost.

A post-generation action adds the Data and Data.Seed projects to your solution.

Entity Framework

Use the provider that matches your database and the versions in Version Compatibility. The task guides cover Forge templates, connection configuration, and local dependencies; the EF Core documentation owns general mapping, query, and migration guidance. Install the EF CLI tools when your workflow needs scaffolding or migrations.

Consider direct SQL or a specialized library for complex reporting queries, latency-sensitive paths, or bulk imports where an ORM adds work without simplifying the task. Measure those paths rather than assuming the provider generates the query you need.