代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/SmartCode 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using Microsoft.Extensions.Logging;
using SmartCode.Configuration;
using SmartCode.Generator.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmartCode.Generator.BuildTasks
{
public abstract class AbstractDbBuildTask : IBuildTask
{
private readonly ILogger _logger;
public AbstractDbBuildTask(string name, ILogger logger)
{
Name = name;
_logger = logger;
}
public bool Initialized { get; protected set; }
public string Name { get; protected set; }
public abstract Task Build(BuildContext context);
public virtual void Initialize(IDictionary<string, object> parameters)
{
this.Initialized = true;
}
protected IList<Table> FilterTable(IEnumerable<Table> tables, string buildKey, Build build)
{
_logger.LogInformation($"FilterTable Build:{buildKey} Start!");
IEnumerable<Table> buildTables = CopyTables(tables);
if (build.IgnoreNoPKTable.HasValue && build.IgnoreNoPKTable.Value)
{
_logger.LogInformation($"FilterTable Build:{buildKey} IgnoreNoPKTable!");
buildTables = buildTables.Where(m => m.PKColumn != null);
}
if (build.IgnoreView.HasValue && build.IgnoreView.Value)
{
_logger.LogInformation($"FilterTable Build:{buildKey} IgnoreView!");
buildTables = buildTables.Where(m => m.Type != Table.TableType.View);
}
if (build.IgnoreTables != null)
{
_logger.LogInformation(
$"FilterTable Build:{buildKey} IgnoreTables: [{String.Join(",", build.IgnoreTables)}]!");
buildTables = buildTables.Where(m => !build.IgnoreTables.Contains(m.Name));
}
if (build.IncludeTables != null)
{
_logger.LogInformation(
$"FilterTable Build:{buildKey} IncludeTables: [{String.Join(",", build.IncludeTables)}]!");
buildTables = buildTables.Where(m => build.IncludeTables.Contains(m.Name));
}
_logger.LogInformation($"FilterTable Build:{buildKey} End!");
return buildTables.ToList();
}
protected IList<Table> CopyTables(IEnumerable<Table> tables)
{
return tables.Select(m => new Table
{
Id = m.Id,
Name = m.Name,
TypeName = m.TypeName,
ConvertedName = m.ConvertedName,
Description = m.Description,
Columns = m.Columns.Select(c => new Column
{
Id = c.Id,
Name = c.Name,
DbType = c.DbType,
Description = c.Description,
AutoIncrement = c.AutoIncrement,
ConvertedName = c.ConvertedName,
IsNullable = c.IsNullable,
IsPrimaryKey = c.IsPrimaryKey,
LanguageType = c.LanguageType,
DataLength = c.DataLength
}).ToList()
}).ToList();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。