.NET Model Generator from SQL

A VS Code extension that generates .NET 8 model classes from SQL CREATE TABLE statements (supports SQL Server, MySQL, and SQLite).

Features
- 🚀 Multi-Database Support: Works with SQL Server, MySQL, and SQLite syntax
- 🛠 Accurate Type Mapping: Converts SQL types to proper C# types (.NET 8)
- 🔍 Comprehensive Annotations:
[Table] and [Column] attributes
[Key] for primary keys
[MaxLength] for string fields
[Required] for non-nullable fields
- ⚙ Configurable:
- Default namespace
- Nullable reference types
- 📂 Automatic File Creation: Generates files in the correct Models folder
Installation
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X )
- Search for ".NET Model Generator from SQL"
- Click Install
Usage
- Open your .NET project in VS Code
- Press
Ctrl+Shift+P to open Command Palette
- Search for and run:
Generate .NET Model from SQL
- Select your database type (SQL Server, MySQL, or SQLite)
- Paste your
CREATE TABLE statement
- The model will be generated in your
Models folder
CREATE TABLE [dbo].[Customers] (
[CustomerID] int PRIMARY KEY,
[Name] nvarchar(100) NOT NULL,
[Email] nvarchar(255),
[Age] int,
[JoinDate] datetime2 NOT NULL,
[IsActive] bit DEFAULT 1
)
| |