diff --git a/CC.Yi.IDAL/CC.Yi.IDAL.csproj b/CC.Yi.IDAL/CC.Yi.IDAL.csproj index bfba3015..91214ffd 100644 --- a/CC.Yi.IDAL/CC.Yi.IDAL.csproj +++ b/CC.Yi.IDAL/CC.Yi.IDAL.csproj @@ -14,6 +14,10 @@ TextTemplatingFileGenerator T4IDAL.cs + + TextTemplatingFileGenerator + T4IDbSession.cs + @@ -26,6 +30,11 @@ True T4IDAL.tt + + True + True + T4IDbSession.tt + diff --git a/CC.Yi.IDAL/T4IDbSession.cs b/CC.Yi.IDAL/T4IDbSession.cs new file mode 100644 index 00000000..aab497df --- /dev/null +++ b/CC.Yi.IDAL/T4IDbSession.cs @@ -0,0 +1,15 @@ +using CC.Yi.Model; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CC.Yi.IDAL +{ + public partial interface IDbSession + { + IstudentDal studentDal{get;} + + } +} \ No newline at end of file diff --git a/CC.Yi.IDAL/T4IDbSession.tt b/CC.Yi.IDAL/T4IDbSession.tt new file mode 100644 index 00000000..b0d2226a --- /dev/null +++ b/CC.Yi.IDAL/T4IDbSession.tt @@ -0,0 +1,33 @@ +<#@ template debug="false" hostspecific="true" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.IO" #> +<#@ output extension=".cs" #> +<# + string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径 + string txt; + StreamReader sr = new StreamReader(solutionsPath+@"\T4Model\T4Model.txt"); + txt=sr.ReadToEnd(); + sr.Close(); + string[] ModelData= txt.Split(','); + #> +using CC.Yi.Model; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CC.Yi.IDAL +{ + public partial interface IDbSession + { +<# foreach(string k in ModelData){ + #> + I<#=k #>Dal <#=k #>Dal{get;} + +<# } #> + } +} \ No newline at end of file