Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>SQL OData Service API GeneratorNew to Visual Studio Code? Get it now.
SQL OData Service API Generator

SQL OData Service API Generator

Sun Auto Tire & Service

|
1 install
| (0) | Free
Generate OData API controllers and repositories from SQL entity classes
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SQL OData API Generator

A VS Code extension that generates OData API controllers and repositories from SQL entity C# classes using Scriban templates.

Setup

Each target project needs a SqlODataServiceApiGenerator.json configuration file. Open the Command Palette (Ctrl+Shift+P) and run SQL OData: Create Configuration File to scaffold one, then fill in the fields described below.

Commit the file alongside your project — it stays in your repository and drives all generation for that project.

Configuration — SqlODataServiceApiGenerator.json

{
  "sourceDirectory": "relative/path/to/entities",
  "outputDirectory": "relative/path/to/output/root",
  "templateDirectory": "",
  "controller": {
    "namespace": "Your.App.Controllers"
  },
  "repository": {
    "namespace": "Your.App.Repositories"
  },
  "dataContext": {
    "type": "Your.App.Services.Data.DataContext"
  },
  "extraUsings": {
    "Controller": [
      "Your.App.SomeNamespace"
    ],
    "Repository": [
      "Your.App.SomeNamespace"
    ]
  }
}
Field Description
sourceDirectory Path to the folder containing entity .cs files. Relative paths resolve from the config file's location.
outputDirectory Root folder where generated files are written. Controllers/ and Repositories/ subfolders are created automatically.
templateDirectory Path to custom Scriban templates. Leave empty to use the extension's bundled templates.
controller.namespace C# namespace applied to every generated controller file.
repository.namespace C# namespace applied to every generated repository file.
dataContext.type Fully-qualified type name of your data context (e.g. Services.Data.DataContext).
extraUsings.Controller Additional using statements added to generated controller files.
extraUsings.Repository Additional using statements added to generated repository files.

Running the Generator

Open the Command Palette and run SQL OData: Run Generator.

The extension looks for SqlODataServiceApiGenerator.json in the workspace root. If it is not found there, a file picker opens so you can locate it manually.

Custom Templates

The extension ships with default Scriban templates for controllers and repositories. To customise generation:

  1. Copy the bundled Templates folder out of the extension's install directory.
  2. Set templateDirectory in your config to point at your copy.
  3. Edit the .scriban files as needed.

To override only specific templates, add a file with the .Custom.scriban suffix (e.g. Controller.Custom.scriban) alongside the defaults — the custom variant takes precedence automatically.

Requirements

  • VS Code 1.85 or later
  • The bundled .NET runtime is self-contained — no separate .NET installation required.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft