DevToolsHub Free · Fast · 100% in your browser

SQL to C# Class

Generate C# classes or records from SQL CREATE TABLE statements (SQL Server, PostgreSQL, MySQL, SQLite).

About this SQL to C# class generator

Generate C# classes or records from SQL CREATE TABLE statements. Column types from SQL Server, PostgreSQL, MySQL and SQLite are mapped to C# types, and nullable columns become nullable properties, ideal for Entity Framework Core or Dapper models.

How to use the SQL to C# Class

  1. Paste one or more CREATE TABLE statements.
  2. Choose class or record output.
  3. Copy the generated C# code.

Example

CREATE TABLE Users (Id INT NOT NULL, Name NVARCHAR(50) NULL)  →  public class Users { public int Id { get; set; } public string? Name { get; set; } }

Frequently asked questions

Which SQL types are supported?

Common numeric, text, date/time, boolean, GUID/uuid and binary types across the major databases are mapped to their C# equivalents.

An unhandled error has occurred. Reload ✕