WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ assembly name="System.Core.dll" #>
<#@ assembly name="System.Data.dll" #>
<#@ assembly name="System.Data.DataSetExtensions.dll" #>
<#@ assembly name="System.Xml.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.IO" #>
<#@ include file="$(ProjectDir)DbHelper.ttinclude"  #>
<#@ include file="$(ProjectDir)ModelAuto.ttinclude"    #>
<# var manager = new Manager(Host, GenerationEnvironment, true); #>
 
 
<# 
    var OutputPath1 =Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Host.TemplateFile+"..")+"..")+"..");
    OutputPath1=Path.Combine(OutputPath1,"JiepeiWMS.Repository","Repositories_New");
    if (!Directory.Exists(OutputPath1))
    {
        Directory.CreateDirectory(OutputPath1);
    }
#>
 
 
//--------------------------------------------------------------------
//     此代码由T4模板自动生成
//       生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#> 
//     对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
<# 
    var tableName=config.TableName;
 #>
<# 
if(tableName!=""){
    #>  
 
 
using JiepeiWMS.Repository.Base;
using JiepeiWMS.Model.Models;
using JiepeiWMS.IRepository;
using JiepeiWMS.IRepository.UnitOfWork;
namespace JiepeiWMS.Repository
{    
    /// <summary>
    /// <#=tableName#>Repository
    /// </summary>    
    public class <#=tableName#>Repository : BaseRepository<<#=tableName#>>, I<#=tableName#>Repository
    {
        public <#=tableName#>Repository(IUnitOfWork unitOfWork) : base(unitOfWork)
        {
        }
       
    }
}
 
<# 
    } else{ 
 
    #>
 
<# 
    SqlConnection conn = new SqlConnection(config.ConnectionString); 
    conn.Open(); 
    System.Data.DataTable schema = conn.GetSchema("TABLES"); 
 #>
 
<# 
    foreach(System.Data.DataRow row in schema.Rows) 
    {  
        manager.StartBlock(row["TABLE_NAME"].ToString()+"Repository"+".cs",OutputPath1);
     #>
    //----------<#=row["TABLE_NAME"].ToString()#>开始----------
    
 
using JiepeiWMS.Repository.Base;
using JiepeiWMS.Model.Models;
using JiepeiWMS.IRepository;
using JiepeiWMS.IRepository.UnitOfWork;
namespace JiepeiWMS.Repository
{    
    /// <summary>
    /// <#=row["TABLE_NAME"].ToString()#>Repository
    /// </summary>    
    public class <#=row["TABLE_NAME"].ToString()#>Repository : BaseRepository<<#=row["TABLE_NAME"].ToString()#>>, I<#=row["TABLE_NAME"].ToString() #>Repository
    {
        public <#=row["TABLE_NAME"].ToString()#>Repository(IUnitOfWork unitOfWork) : base(unitOfWork)
        {
        }
       
    }
}
 
    //----------<#=row["TABLE_NAME"].ToString()#>结束----------
    <# 
        manager.EndBlock(); 
        } 
 
        {  
        manager.StartBlock("BaseRepository.cs",OutputPath1);//文件名
     #>
    
    //----------开始----------
    
using JiepeiWMS.Repository.Base;
using JiepeiWMS.Model.Models;
using JiepeiWMS.IRepository;
using JiepeiWMS.IRepository.UnitOfWork;
namespace JiepeiWMS.Repository
{    
    /// <summary>
    /// IBaseRepository
    /// </summary>    
     public  class BaseRepository<TEntity> : IBaseRepository<TEntity> where TEntity : class, new()
    {
 
       
    }
}
 
    //----------结束----------
    <# 
        manager.EndBlock(); 
        } 
 
 
        manager.Process(true);
    }
    #>