<#@ template debug="true" hostspecific="true" language="C#" #> <#@ assembly name="System.Core" #> <#@ assembly name="System.Data" #> <#@ assembly name="$(SolutionDir)\Lib\SCADA.CommonLib.dll" #> <#@ assembly name="$(SolutionDir)\Lib\System.Data.SQLite.dll" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ import namespace="System.Data" #> <#@ import namespace="SCADA.CommonLib.Data"#> <#@ import namespace="SCADA.CommonLib.Data.DIL"#> <#@ import namespace="SCADA.CommonLib.Data.DIL.MSSql"#> <#@ import namespace="SCADA.CommonLib.Data.DIL.MySql"#> <#@ import namespace="SCADA.CommonLib.Data.DIL.Sqlite"#> <#@ import namespace="SCADA.CommonLib.Data.DIL.Oracle"#> <#@ import namespace="SCADA.CommonLib.Data.DIL.NpgSql"#> <#@ import namespace="SCADA.CommonLib.Data.DIL.Sqlite"#> <#@ import namespace="Microsoft.VisualStudio.TextTemplating"#> <#@ output extension=".cs" #> <# string ttpath = this.Host.TemplateFile; string projectPath=Host.ResolveAssemblyReference("$(SolutionDir)"); string outPath=Host.ResolveAssemblyReference("$(TargetDir)"); // IDB db=new SQLDB("127.0.0.1,1433","EICP","sa","123456"); // IDB db=new OracleDB("127.0.0.1:1521","EICP","sa","123456"); // IDB db=new MySQLDB("127.0.0.1:3306","EICP","sa","123456"); string dataPath=@$"{projectPath}\SCADA_DAQ\bin\Debug\net47\Data"; IDB db=new SQLiteDB(dataPath,"Platform.db"); #> using System; using System.Collections.Generic; using System.Linq.Expressions; using SCADA.CommonLib; using SCADA.CommonLib.Data; using SCADA.CommonLib.Data.DIL; <#if(db is SQLDB) { WriteLine("using System.Data.SqlClient;"); WriteLine("using SCADA.CommonLib.Data.DIL.MSSql;"); } else if(db is MySQLDB) { WriteLine("using SCADA.CommonLib.Data.DIL.MySql;"); } else if(db is SQLiteDB) { WriteLine("using SCADA.CommonLib.Data.DIL.Sqlite;"); } else if(db is OracleDB) { WriteLine("using SCADA.CommonLib.Data.DIL.Oracle;"); } else if(db is NpgSQLDB) { WriteLine("using SCADA.CommonLib.Data.DIL.NpgSql;"); } #> namespace DBSchema { <#= db.GetProduceDefine() #> } namespace DBNames { <#=db.GetTableColumnsDefine() #> <#=db.GetViewColumnsDefine() #> <#=db.GetProduceParametersDefine() #> } namespace DBModel { <#= db.GetDBModel() #> } namespace DIL { <#if(db is SQLDB) { WriteLine(" public class DILDB:SQLDB"); } else if(db is MySQLDB) { WriteLine(" public class DILDB:MySQLDB"); } else if(db is SQLiteDB) { WriteLine(" public class DILDB:SQLiteDB"); } else if(db is OracleDB) { WriteLine(" public class DILDB:OracleDB"); } else if(db is NpgSQLDB) { WriteLine(" public class DILDB:NpgSQLDB"); } #> { <#= db.GetDeclare() #> } }