-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat]新增代码生成插件ICodePlugin,各个团队可以根据自己需要编写插件,从而控制代码生成效果
- Loading branch information
Showing
5 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using NewLife; | ||
using NewLife.Model; | ||
using XCode.DataAccessLayer; | ||
|
||
namespace XCode.Code; | ||
|
||
/// <summary>代码生成插件</summary> | ||
public interface ICodePlugin : IPlugin | ||
{ | ||
/// <summary>修正数据表</summary> | ||
/// <param name="tables"></param> | ||
void FixTables(IList<IDataTable> tables); | ||
} | ||
|
||
/// <summary>代码生成插件基类</summary> | ||
[Plugin("CodeBuild")] | ||
public abstract class CodePlugin : DisposeBase, ICodePlugin | ||
{ | ||
/// <summary>服务提供者</summary> | ||
public IServiceProvider? Provider { get; set; } | ||
|
||
/// <summary>初始化插件</summary> | ||
/// <param name="identity"></param> | ||
/// <param name="provider"></param> | ||
/// <returns></returns> | ||
/// <exception cref="NotImplementedException"></exception> | ||
public virtual Boolean Init(String? identity, IServiceProvider provider) | ||
{ | ||
if (identity != "CodeBuild") return false; | ||
|
||
Provider = provider; | ||
|
||
return true; | ||
} | ||
|
||
/// <summary>修正数据表</summary> | ||
/// <param name="tables"></param> | ||
public virtual void FixTables(IList<IDataTable> tables) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters