CodegenCS.DbSchema
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package CodegenCS.DbSchema --version 1.0.0
NuGet\Install-Package CodegenCS.DbSchema -Version 1.0.0
<PackageReference Include="CodegenCS.DbSchema" Version="1.0.0" />
paket add CodegenCS.DbSchema --version 1.0.0
#r "nuget: CodegenCS.DbSchema, 1.0.0"
// Install CodegenCS.DbSchema as a Cake Addin #addin nuget:?package=CodegenCS.DbSchema&version=1.0.0 // Install CodegenCS.DbSchema as a Cake Tool #tool nuget:?package=CodegenCS.DbSchema&version=1.0.0
CodegenCS.DbSchema
This is a Plugin (Datasource Provider) to be used with CodegenCS code generator, which allows CodegenCS to generate code based on a Database Schema.
Basically it contains classes to represent the Database Schema, a Schema Reader class to read the Schema from a MS SQL Server database, and PowerShell/CSX scripts to invoke it directly (if you don't want to build it into a .NET Project).
The JSON schema can be used by any application, this is not tied to CodegenCS in any way.
Description
This project contains C# code and a CSX (C# Script file) which executes the C# code. There's also a PowerShell Script which helps to launch the CSX script.
This is cross-platform code and can be embedded into any project (even a class library, there's no need to build an exe since CSX is just invoked by a scripting runtime).
This code only uses netstandard2.0 libraries, so any project (.NET Framework or .NET Core) can use these scripts.
Actually the scripts are executed using CSI (C# REPL), which is a scripting engine - the CSPROJ just helps us to test/compile, use NuGet packages, etc.
Usage
Just copy these files into your project, tweak connection string, and execute the PowerShell script.
If you want to run in a .NET project you can use like this:
public void ExtractSchema()
{
string outputJsonSchema = "AdventureWorksSchema.json");
string connectionString = @"Data Source=MYDESKTOP\SQLEXPRESS;
Initial Catalog=AdventureWorks;
Integrated Security=True;";
Func<IDbConnection> connectionFactory = () => new SqlConnection(connectionString);
var reader = new SqlServerSchemaReader(connectionFactory);
reader.ExportSchemaToJSON(outputJsonSchema);
}
Code
https://github.com/Drizin/CodegenCS/tree/master/src/CodegenCS.DbSchema
License
MIT License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Dapper (>= 2.0.35)
- Newtonsoft.Json (>= 12.0.3)
-
.NETStandard 2.0
- Dapper (>= 2.0.35)
- Newtonsoft.Json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.