SmartCode 1.0.0
See the version list below for details.
dotnet add package SmartCode --version 1.0.0
NuGet\Install-Package SmartCode -Version 1.0.0
<PackageReference Include="SmartCode" Version="1.0.0" />
paket add SmartCode --version 1.0.0
#r "nuget: SmartCode, 1.0.0"
// Install SmartCode as a Cake Addin #addin nuget:?package=SmartCode&version=1.0.0 // Install SmartCode as a Cake Tool #tool nuget:?package=SmartCode&version=1.0.0
SmartCode
SmartCode = IDataSource → IBuildTask → IOutput ⇒ Build Everything
Introduction
SmartCode.Db (代码生成器)
Demo
Getting Started
- Install from .NET Core Global Tool
dotnet tool install --global SmartCode.CLI --version 1.0.0
- 编辑构建配置文件(默认:SmartCode.yml)
- 命令行执行SmartCode命令
- SmartCode
- 等待提示输入配置文件路径(可选:默认程序根目录下SmartCode.yml文件)
- 回车执行命令
- 等待任务执行结束
- 查看输出目录结果
构建配置文件
Module: SmartSql.Starter
Author: Ahoo Wang
DataSource:
Name: Db
Paramters:
DbName: SmartSqlStarterDB
DbProvider: SqlServer
ConnectionString: Data Source=.;Initial Catalog=SmartSqlStarterDB;Integrated Security=True
Language: CSharp
TemplateEngine: Razor
Output:
Type: File
Path: 'E://SmartSql-Starter'
# 构建任务
Build:
ClearDir:
Type: Clear
Paramters:
Dirs: '.'
Solution:
Type: Project
Template: Sln.cshtml
Output:
Path: '.'
Name: '{{Project.Module}}'
Extension: '.sln'
SmartSqlConfig:
Type: Project
Template: SqlMapConfig.cshtml
Output:
Path: '{{Project.Module}}.API'
Name: 'SmartSqlMapConfig'
Extension: '.xml'
Entity_Project:
Type: Project
Template: Proj.cshtml
Output:
Path: '{{Project.Module}}.Entity'
Name: '{{Project.Module}}.Entity'
Extension: '.csproj'
Entity:
Type: Table
Module: Entity
Template: Entity.cshtml
Output:
Path: '{{Project.Module}}.{{Build.Module}}'
Extension: '.cs'
NamingConverter:
Table:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'T_'
Delimiter: '_'
Converter:
Type: Default
Paramters: { }
View:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'V_'
Delimiter: '_'
Converter:
Type: Pascal
Column:
Tokenizer:
Type: Default
Paramters:
Delimiter: '_'
Converter:
Type: Pascal
Repository_Project:
Type: Project
Template: Proj-Repository.cshtml
Output:
Path: '{{Project.Module}}.Repository'
Name: '{{Project.Module}}.Repository'
Extension: '.csproj'
Repository:
Type: Table
Module: Repository
Template: Repository.cshtml
Output:
Path: '{{Project.Module}}.{{Build.Module}}'
Name: 'I{{OutputName}}Repository'
Extension: .cs
NamingConverter:
Table:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'T_'
Delimiter: '_'
Converter:
Type: Default
View:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'V_'
Delimiter: '_'
Converter:
Type: Default
SqlMap:
Type: Table
Template: SqlMap-SqlServer.cshtml
Output:
Path: '{{Project.Module}}.API/Maps'
Extension: .xml
IgnoreTables: null
NamingConverter:
Table:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'T_'
Delimiter: '_'
Converter:
Type: Default
View:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'V_'
Delimiter: '_'
Converter:
Type: Default
Column:
Tokenizer:
Type: Default
Paramters:
IgnorePrefix: 'T_'
Delimiter: '_'
Converter:
Type: Default
参数名 | 说明 |
---|---|
Module | 根模块名 |
Author | 作者 |
DataSource | 数据源 |
Language | 语言:CSharp/Java/.... |
TemplateEngine | 模板引擎:目前内置:Razor/Handlebars |
Output | 输出 |
Build | 任务构建s |
DataSource 数据源,Name:Db
属性 Name:Db,使用DbSource插件作为数据源
DbSource.Paramters 接受以下三个参数:
参数名 | 说明 |
---|---|
DbName | 数据库名称 |
DbProvider | 数据驱动提供者:MySql,MariaDB,PostgreSql,SqlServer,Oracle,SQLite |
ConnectionString | 连接字符串 |
Build 任务构建
参数名 | 说明 |
---|---|
Type | 构建类型,Clear:用于清理目录s/文件s,Project:用于构建单文件,如:解决方案文件/项目文件,Table: 用于构建以数据表为基础的文件,如:Entity,Repository文件 |
Module | 构建模块名 |
TemplateEngine | 模板引擎,可选,默认使用根模块引擎 |
Template | 模板文件 |
Output | 输出 |
IncludeTables | 包括表名s |
IgnoreTables | 忽略表名s |
NamingConverter | 命名转换器 |
Paramters | 自定义构建参数 |
NamingConverter 命名转换
属性 | 说明 |
---|---|
类型 | Table/View/Column |
Tokenizer | 分词器 |
Converter | 转换器:Camel/Pascal/None |
NamingConverter.Tokenizer 分词器
属性 | 说明 |
---|---|
Type | Default |
Paramters.IgnorePrefix | 忽略前缀字符 |
Paramters.Delimiter | 分隔符 |
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 was computed. 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 2.1.0)
- Newtonsoft.Json (>= 11.0.2)
- YamlDotNet (>= 5.2.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on SmartCode:
Package | Downloads |
---|---|
SmartCode.TemplateEngine
SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!! |
|
SmartCode.Db
SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!! |
|
SmartCode.ETL
SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!! |
|
SmartCode.Generator
SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!! |
|
SmartCode.App
SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!! |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.1 | 597 | 6/16/2022 |
3.0.0 | 476 | 3/3/2022 |
2.4.0-preview.1 | 115 | 6/15/2022 |
2.4.0-preview.0 | 115 | 5/7/2022 |
2.3.7 | 571 | 3/3/2022 |
2.3.6 | 543 | 6/10/2020 |
2.3.5 | 496 | 4/29/2020 |
2.3.4 | 518 | 3/27/2020 |
2.3.3 | 532 | 3/27/2020 |
2.3.2 | 501 | 3/11/2020 |
2.3.1 | 522 | 3/11/2020 |
2.3.0 | 536 | 3/11/2020 |
2.2.95 | 552 | 2/17/2020 |
2.2.94 | 566 | 2/14/2020 |
2.2.93 | 510 | 2/14/2020 |
2.2.92 | 549 | 11/18/2019 |
2.2.90 | 536 | 11/12/2019 |
2.2.88 | 574 | 10/30/2019 |
2.2.86 | 538 | 10/23/2019 |
2.2.85 | 526 | 10/22/2019 |
2.2.84 | 542 | 10/22/2019 |
2.2.83 | 570 | 10/22/2019 |
2.2.82 | 562 | 10/21/2019 |
2.2.81 | 560 | 10/21/2019 |
2.2.80 | 546 | 10/21/2019 |
2.2.70 | 5,216 | 8/21/2019 |
2.2.68 | 4,908 | 8/5/2019 |
2.2.66 | 5,378 | 8/5/2019 |
2.2.65 | 1,952 | 7/22/2019 |
2.2.58 | 3,387 | 7/12/2019 |
1.0.0 | 856 | 10/7/2018 |