Skip to content

Tool that lets you generate the C# model classes from existing SQL Database.

License

Notifications You must be signed in to change notification settings

IMujagic/sql-to-sharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This tool lets you generate the C# model classes from existing SQL Database.

Actions Status

Parameters

Following parameters are required in order to run the generator successfully:

  • --dbms Specifies the DBMS type, e.g. SqlServer, Postgres (Currently only SqlServer is supported)
  • --conn-string Specifies the target database connection string
  • --output-dir Path to the directory where the classes will be generated
  • --namespace Namespace under which the classes will be generated
  • --ignore Optional argument that gives option to ignore specific tables

Installation

Install as a NuGet global tool: dotnet tool install --global SqlToSharp

Usage

Tool can be started from the project or published and installed as the .NET Core Global Tool.

If the Global Tool is installed then the generator can be invoked by sql2sharp command together with required arguments.

Command example

sql2sharp \
    --dbms "SqlServer" \
    --conn-string "Data Source=.;Initial Catalog=SampleDB;Integrated Security=true" \
    --output-dir "./Output" \
    --namespace "Sample.DbModel"

If you want to start it from source, first clone this repository, position yourself inside ./Src folder and run following command

Command example

dotnet run \
    --dbms "SqlServer" \
    --conn-string "Data Source=.;Initial Catalog=SampleDB;Integrated Security=true" \
    --output-dir "./Output" \
    --namespace "Sample.DbModel"

About

Tool that lets you generate the C# model classes from existing SQL Database.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published