SmartCode.CLI 2.1.9

SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!!

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global SmartCode.CLI --version 2.1.9
This package contains a .NET Core Global Tool you can call from the shell/command line.

SmartCode

SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything

Introduction

SmartCode

SmartCode.Db (Code generator)

Demo

SmartCode

Getting Started

  1. Install from .NET Core Global Tool
dotnet tool install --global SmartCode.CLI
  1. edit build configuration file (default: SmartCode.yml)
  2. the command line executes the SmartCode command.
    • SmartCode
    • wait for prompt to enter the configuration file path (optional: SmartCode.yml file in the default program root directory)
    • carriage return execution command
  3. wait for the end of the task execution.
  4. View output directory results

Building configuration files

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

| Parameter Name | Description |
| :--------- | --------:|
| Module | Root Module Name |
| Author | Author |
| DataSource | Data Source |
| Language | Language: CSharp/Java/.... |
| TemplateEngine | Template Engine: Currently Built: Razor/Handlebars |
| Output | Output |
| Build | Task Build |

DataSource Data Source, Name: Db

Property Name: Db, using the DbSource plugin as a data source

DbSource.Paramters accepts the following three parameters:

| Parameter Name | Description |
| :--------- | --------:|
| DbName | Database Name |
| DbProvider | Data Drivers: MySql, MariaDB, PostgreSql, SqlServer, Oracle, SQLite |
| ConnectionString | Connection String |

Build Task Build

| Parameter Name | Description |
| :--------- | --------:|
| Type | Build type, Clear: used to clean up the directory s / file s, Project: used to build a single file, such as: solution file / project file, Table: used to build a data table-based file, such as: Entity , Repository file|
| Module | Building Module Name |
| TemplateEngine | Template Engine, optional, default to root module engine |
| Template | Template File |
| Output | Output |
| IncludeTables | Include table name s |
| IgnoreTables | Ignore table name s |
| NamingConverter | Named Converter |
| Paramters | Custom Build Parameters |

NamingConverter Name Conversion

| Attribute | Description |
| :--------- | --------:|
| Type | Table/View/Column |
| Tokenizer | Word Segmenter |
| Converter | Converter: Camel/Pascal/None |

NamingConverter.Tokenizer Word Segmenter

| Attribute | Description |
| :--------- | --------:|
| Type | Default |
| Paramters.IgnorePrefix | Ignore prefix characters |
| Paramters.Delimiter | Separator |

How to contribute a template

In order to allow more people to participate in the construction of SmartCode templates, there are the following template specifications:

  1. The template author creates a new directory in src/SmartCode.Generator/RazorTemplates and names it in the author's English name.
  2. Place the template in the author directory
  3. The README.md file must be included in the author directory to illustrate the purpose of the template and how it is used.
  4. Submit PR

SmartCode.ETL(Extract-Transform-Load)

ETL Building configuration files

Author: Ahoo Wang
DataSource:
  Name: Extract
  Paramters:
    DbProvider: SqlServer
    ConnectionString: Data Source=.;Initial Catalog=SmartSqlDB;Integrated Security=True
    Query: SELECT [Id],[UserName],[Pwd],[Status],[LastLoginTime],[CreationTime],[Deleted] FROM [T_User] Where Id>@LastMaxId And CreationTime>@LastQueryTime
    PKColumn: Id

Paramters:
  ETLCode: SmartCode.ETL.Test
  ETLRepository: PG
  
Build:

  Transform:
    Type: Transform
    Paramters:
      Script: Load2PostgreSql.cshtml

  Load2PostgreSql: 
    Type: Load
    Paramters:
      DbProvider: PostgreSql
      ConnectionString: Server=localhost;Port=5432;User Id=postgres;Password=SmartSql; Database=smartsql_db;
      Table: t_user
      ColumnMapping: [{Column: UserName,Mapping: user_name}
      ,{Column: Pwd,Mapping: pwd}
      ,{Column: Status,Mapping: status}
      ,{Column: LastLoginTime,Mapping: lastlogintime}
      ,{Column: CreationTime,Mapping: creationtime}
      ,{Column: Deleted,Mapping: deleted}]
      PreCommand: 
      PostCommand: 

SmartCode

SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything

Introduction

SmartCode

SmartCode.Db (Code generator)

Demo

SmartCode

Getting Started

  1. Install from .NET Core Global Tool
dotnet tool install --global SmartCode.CLI
  1. edit build configuration file (default: SmartCode.yml)
  2. the command line executes the SmartCode command.
    • SmartCode
    • wait for prompt to enter the configuration file path (optional: SmartCode.yml file in the default program root directory)
    • carriage return execution command
  3. wait for the end of the task execution.
  4. View output directory results

Building configuration files

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

| Parameter Name | Description |
| :--------- | --------:|
| Module | Root Module Name |
| Author | Author |
| DataSource | Data Source |
| Language | Language: CSharp/Java/.... |
| TemplateEngine | Template Engine: Currently Built: Razor/Handlebars |
| Output | Output |
| Build | Task Build |

DataSource Data Source, Name: Db

Property Name: Db, using the DbSource plugin as a data source

DbSource.Paramters accepts the following three parameters:

| Parameter Name | Description |
| :--------- | --------:|
| DbName | Database Name |
| DbProvider | Data Drivers: MySql, MariaDB, PostgreSql, SqlServer, Oracle, SQLite |
| ConnectionString | Connection String |

Build Task Build

| Parameter Name | Description |
| :--------- | --------:|
| Type | Build type, Clear: used to clean up the directory s / file s, Project: used to build a single file, such as: solution file / project file, Table: used to build a data table-based file, such as: Entity , Repository file|
| Module | Building Module Name |
| TemplateEngine | Template Engine, optional, default to root module engine |
| Template | Template File |
| Output | Output |
| IncludeTables | Include table name s |
| IgnoreTables | Ignore table name s |
| NamingConverter | Named Converter |
| Paramters | Custom Build Parameters |

NamingConverter Name Conversion

| Attribute | Description |
| :--------- | --------:|
| Type | Table/View/Column |
| Tokenizer | Word Segmenter |
| Converter | Converter: Camel/Pascal/None |

NamingConverter.Tokenizer Word Segmenter

| Attribute | Description |
| :--------- | --------:|
| Type | Default |
| Paramters.IgnorePrefix | Ignore prefix characters |
| Paramters.Delimiter | Separator |

How to contribute a template

In order to allow more people to participate in the construction of SmartCode templates, there are the following template specifications:

  1. The template author creates a new directory in src/SmartCode.Generator/RazorTemplates and names it in the author's English name.
  2. Place the template in the author directory
  3. The README.md file must be included in the author directory to illustrate the purpose of the template and how it is used.
  4. Submit PR

SmartCode.ETL(Extract-Transform-Load)

ETL Building configuration files

Author: Ahoo Wang
DataSource:
  Name: Extract
  Paramters:
    DbProvider: SqlServer
    ConnectionString: Data Source=.;Initial Catalog=SmartSqlDB;Integrated Security=True
    Query: SELECT [Id],[UserName],[Pwd],[Status],[LastLoginTime],[CreationTime],[Deleted] FROM [T_User] Where Id>@LastMaxId And CreationTime>@LastQueryTime
    PKColumn: Id

Paramters:
  ETLCode: SmartCode.ETL.Test
  ETLRepository: PG
  
Build:

  Transform:
    Type: Transform
    Paramters:
      Script: Load2PostgreSql.cshtml

  Load2PostgreSql: 
    Type: Load
    Paramters:
      DbProvider: PostgreSql
      ConnectionString: Server=localhost;Port=5432;User Id=postgres;Password=SmartSql; Database=smartsql_db;
      Table: t_user
      ColumnMapping: [{Column: UserName,Mapping: user_name}
      ,{Column: Pwd,Mapping: pwd}
      ,{Column: Status,Mapping: status}
      ,{Column: LastLoginTime,Mapping: lastlogintime}
      ,{Column: CreationTime,Mapping: creationtime}
      ,{Column: Deleted,Mapping: deleted}]
      PreCommand: 
      PostCommand: 

Release Notes

1. change sln  directory structure

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
2.3.5 52 4/29/2020
2.3.4 93 3/27/2020
2.3.3 70 3/27/2020
2.3.2 70 3/11/2020
2.3.1 58 3/11/2020
2.3.0 71 3/11/2020
2.2.95 102 2/17/2020
2.2.94 100 2/14/2020
2.2.93 46 2/14/2020
2.2.92 187 11/18/2019
2.2.90 71 11/12/2019
2.2.88 94 10/30/2019
2.2.86 83 10/23/2019
2.2.85 77 10/22/2019
2.2.84 70 10/22/2019
2.2.83 79 10/22/2019
2.2.82 78 10/21/2019
2.2.81 85 10/21/2019
2.2.80 83 10/21/2019
2.2.70 169 8/21/2019
2.2.68 146 8/5/2019
2.2.66 114 7/29/2019
2.2.65 119 7/22/2019
2.2.62 105 7/19/2019
2.2.60 97 7/19/2019
2.2.58 139 7/10/2019
2.2.57 131 7/8/2019
2.2.56 142 6/28/2019
2.2.55 164 6/11/2019
2.2.53 129 6/10/2019
2.2.52 159 6/4/2019
2.2.50 145 6/3/2019
2.2.48 148 5/23/2019
2.2.46 146 5/23/2019
2.2.45 1,015 5/7/2019
2.2.44 151 5/6/2019
2.2.42 253 4/30/2019
2.2.40 144 4/30/2019
2.2.38 148 4/30/2019
2.2.36 141 4/29/2019
2.2.30 140 4/26/2019
2.2.25 180 4/26/2019
2.2.22 165 4/25/2019
2.2.20 187 4/24/2019
2.2.10 224 4/23/2019
2.2.8 204 4/23/2019
2.2.2 154 4/18/2019
2.2.0 153 4/16/2019
2.1.10 150 4/16/2019
2.1.9 174 4/11/2019
2.1.8 159 4/10/2019
2.1.6 142 4/10/2019
2.1.5 162 4/1/2019
2.1.3 153 3/29/2019
2.1.2 158 3/25/2019
2.1.1 166 3/22/2019
2.1.0 171 3/22/2019
2.0.5 209 2/27/2019
2.0.4 343 12/17/2018
2.0.2 190 12/14/2018
2.0.0 100,823 12/14/2018
1.18.2 113,091 11/22/2018
1.18.1 13,502 11/16/2018
1.16.20 10,813 11/16/2018
1.16.19 10,324 11/16/2018
1.16.18 5,041 11/14/2018
1.16.16 1,688 11/7/2018
1.16.15 257 11/4/2018
1.16.13 7,207 11/4/2018
1.16.12 2,176 11/1/2018
1.16.6 8,496 10/31/2018
1.16.2 8,984 10/31/2018
1.16.1 44,681 10/31/2018
1.16.0 208 10/30/2018
1.12.0 238 10/30/2018
1.9.0 651 10/27/2018
1.8.1 898 10/26/2018
1.8.0 960 10/25/2018
1.7.6 1,112 10/24/2018
1.7.5 1,173 10/24/2018
1.7.2 1,381 10/22/2018
1.7.1 955 10/21/2018
1.6.9 298 10/20/2018
1.6.8.1 767 10/20/2018
1.6.8 549 10/20/2018
1.6.2 243 10/19/2018
1.5.0 279 10/18/2018
1.4.6 202 10/18/2018
1.3.9 309 10/17/2018
1.3.8 244 10/17/2018
1.3.6 199 10/15/2018
1.3.4 403 10/11/2018
1.3.0 243 10/9/2018
1.2.0 219 10/8/2018
1.1.0 209 10/7/2018
1.0.0 241 10/7/2018
Show less