SqlArtisan.TableClassGen 0.2.0-alpha.1

Prefix Reserved
This is a prerelease version of SqlArtisan.TableClassGen.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet tool install --global SqlArtisan.TableClassGen --version 0.2.0-alpha.1
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local SqlArtisan.TableClassGen --version 0.2.0-alpha.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SqlArtisan.TableClassGen&version=0.2.0-alpha.1&prerelease
                    
nuke :add-package SqlArtisan.TableClassGen --version 0.2.0-alpha.1
                    

SqlArtisan.TableClassGen

A .NET tool that generates C# table schema classes from your database for SqlArtisan, enabling robust type-safety and IntelliSense in your query building.

Installation

Install sa-tableclassgen as a .NET global tool to make it accessible from any location:

(Note: These packages are currently in their pre-release phase, so use the --prerelease flag when installing.)

dotnet tool install --global SqlArtisan.TableClassGen --prerelease

Usage

The command to invoke the tool is:

sa-tableclassgen

Example Execution

Interactive Command Session

Here's an example of the interactive prompts when running the sa-tableclassgen command:

Please enter database information.
Database type (1.Oracle/2.PostgreSQL): 2
Host: localhost
Port: 5432
Service name (or database name): myservice
Schema: myschema
Username: myuser
Password: *****

Please enter code generation settings.
Namespace: MyAppNamespace
Convert object names to lowercase (y/n): y
Output directory: c:\output
Create subfolders by table name initial (y/n): y
Specific table name (leave empty for all tables):

Retrieving all tables from database...
Found 17 tables. Generating class files...
Successfully generated 17 out of 17 table classes.
Table class generation process completed successfully.

Output: Example Table Schema Class

As a result of the command, a C# class similar to the following would be generated (e.g., for a 'category' table):

using SqlArtisan;

namespace MyAppNamespace;

internal sealed class UsersTable : DbTableBase
{
    public UsersTable(string tableAlias = "") : base("users", tableAlias)
    {
        Id = new DbColumn(tableAlias, "id");
        Name = new DbColumn(tableAlias, "name");
        CreatedAt = new DbColumn(tableAlias, "created_at");
    }

    public DbColumn Id { get; }
    public DbColumn Name { get; }
    public DbColumn CreatedAt { get; }
}

License

This project is licensed under the MIT License. See the LICENSE file for the full license text.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.2.0-beta.1 104 7/11/2025
0.2.0-alpha.1 137 6/19/2025