.net core + mvc hand line and a code generator

Recently nothing else, always want to buy and sell something, simply get under the code generator, thanks to strong support boss leaves FreeSql here.

Previously we used two good code generator, here to talk about my views

1. dynamic soft code generator, the advantage is clear, free, simple, but not highly customizable (to do some processing on the basis of a template, change the file name rules, etc. ....)

2.CodeSmith, the advantage is powerful, but charges crack trouble, trouble also multi-write rules template

Here first on the map, Layui page layout using the + zTree + jq

Here to talk about the simple play

Add Server NO.1

 

 Select the database type, fill in the server name (can be filled freely) and address (complete connection address, including the port), you can specify the database, do not specify all the database is loaded, click Save will save the server information to sqlite

NO.2 get more information at the database server

Click the connection you just added server, asynchronously loads all the information at the server, and cache information table

NO.3 configuration template information

Template view corresponds with all templates are based on the Razor engine code is as follows

@model TableConfig
<pre>
using System;
//EFX Code Generation Template 1.0
//author:Tibos
//blog:www.cnblogs.com/Tibos
//Entity Code Generation Template
namespace [email protected]
{
    //@Model.FullName;
    public class @Model.FullName:BaseEntity
    {
    @foreach (var item in Model.ColumnConfig)
    {
        <text>
        /// <summary>
        /// @Html.Raw(item.Remark)
        /// </summary>
        public virtual @item.CsType @item.PropName
        {
            get; 
            set; 
        }  
        </text>
    }

    }
}
</pre>

NO.4 展开数据库,勾选需要生成表以及模板,点击生成即可

 编译好的打包文件下载,需要安装.net core SDK, Shift + 鼠标右键启动 PowerShell,输入 dotnet .\CodeGenerator.dll,打开浏览器输入 http://localhost:9420/home/index 即可

 开源地址:https://github.com/wmowm/EFX.Core/tree/master/CodeGenerator

不知道github怎么下载指定目录的,直接访问 https://minhaskamal.github.io/DownGit/#/home?url=https:%2F%2Fgithub.com%2Fwmowm%2FEFX.Core%2Ftree%2Fmaster%2FCodeGenerator

Guess you like

Origin www.cnblogs.com/tibos/p/11364482.html