模板是C#语法的 .cst文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <%@ CodeTemplate Language= "C#" TargetLanguage= "Text" ResponseEncoding= "UTF-8" Src= "" Inherits= "" Debug= "False" CompilerVersion= "v3.5" Description= "Template description here." %> <%@ Property Name= "ModelClassNameSpace" Type= "System.String" Default= "ModelClassNameSpace" Optional= "False" Category= "Strings" Description= "This is ModelClassNameSpace" %> <%@ Assembly Name= "SchemaExplorer" %> <%@ Import Namespace= "SchemaExplorer" %> <%@ Import Namespace= "System.Windows.Forms.Design" %> <%@ Import Namespace= "System.Drawing.Design" %> <%@ Import Namespace= "System.IO" %> <script runat= "template" > private DatabaseSchema _sourceDatabase; [Category( "Database" )] [Description( "This is a DatabaseSource" )] public DatabaseSchema SourceDatabase { get { return this ._sourceDatabase;} set {_sourceDatabase= value;} } //设置类文件名称 public string GetClassName(TableSchema table) { //if (table.Name.EndsWith("s")) //{ //return table.Name.Substring(0, table.Name.Length - 1) + "Entity"; //} //else //{ // return table.Name+"Entity"; //} return FormatTable(table.Name); } //格式化表名 public string FormatTable( string param) { string [] p =param.Split( '_' ); return p[p.Length-1].ToString(); } </script> <% foreach (TableSchema table in _sourceDatabase.Tables) { %> //<%=table.Description%> kernel.Bind<ADT.Eppendorf.IBLL.APP.I<%=FormatTable(table.Name)%>>().To<ADT.Eppendorf.BLL.APP.<%=FormatTable(table.Name)%>>(); kernel.Bind<ADT.Eppendorf.IDAL.APP.I<%=FormatTable(table.Name)%>>().To<ADT.Eppendorf.DAL.APP.<%=FormatTable(table.Name)%>>(); <% } %> |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】