Files
Yi.Admin/CC.Yi.Old/CC.Yi.DALFactory/T4StaticDalFactory.tt

43 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-03-20 14:12:24 +08:00
<#@ 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(',');
#>
2021-05-31 21:41:27 +08:00
using CC.Yi.DAL;
2021-03-20 14:12:24 +08:00
using CC.Yi.IDAL;
using System;
2021-05-31 21:41:27 +08:00
using System.Collections.Concurrent;
2021-03-20 14:12:24 +08:00
using System.Collections.Generic;
using System.Text;
2021-05-31 21:41:27 +08:00
using System.Threading;
2021-03-20 14:12:24 +08:00
2021-05-31 21:41:27 +08:00
namespace CC.Yi.DALFactory
2021-03-20 14:12:24 +08:00
{
2021-05-31 21:41:27 +08:00
public partial class StaticDalFactory
{
2021-03-20 14:12:24 +08:00
<# foreach(string k in ModelData){
#>
2021-05-31 21:41:27 +08:00
public static I<#=k #>Dal Get<#=k #>Dal()
2021-03-20 14:12:24 +08:00
{
2021-05-31 21:41:27 +08:00
I<#=k #>Dal Data = CallContext.GetData("<#=k #>Dal") as I<#=k #>Dal;
if (Data == null)
{
Data = new <#=k #>Dal();
CallContext.SetData("<#=k #>Dal", Data);
}
return Data;
2021-03-20 14:12:24 +08:00
}
2021-05-31 21:41:27 +08:00
2021-03-20 14:12:24 +08:00
<# } #>
2021-05-31 21:41:27 +08:00
}
2021-03-20 14:12:24 +08:00
}