41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
<#@ template debug="false" hostspecific="true" language="C#" #>
|
|
<#@ assembly name="System.Core" #>
|
|
<#@ import namespace="System.Linq" #>
|
|
<#@ import namespace="System.Text" #>
|
|
<#@ import namespace="System.IO" #>
|
|
<#@ import namespace="System.Collections.Generic" #>
|
|
<#@ output extension=".cs" #>
|
|
<#
|
|
string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径
|
|
string dirPath= Path.Combine(solutionsPath,@"Yi.Framework.Model\Models\");
|
|
DirectoryInfo dir = new DirectoryInfo(dirPath);
|
|
FileInfo[] finfo = dir.GetFiles();
|
|
string filenames = string.Empty;
|
|
List<string> filenameList = new List<string>();
|
|
for (int i = 0; i < finfo.Length; i++)
|
|
{
|
|
filenames = finfo[i].Name ;
|
|
string[] f=filenames.Split('.');
|
|
filenameList.Add(f[0]);
|
|
}
|
|
|
|
|
|
#>
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Yi.Framework.Model.Models;
|
|
|
|
namespace Yi.Framework.Model
|
|
{
|
|
public partial class DataContext :DbContext
|
|
{
|
|
<# foreach(string k in filenameList){
|
|
#>
|
|
public DbSet<<#=k #>> <#=k #> { get; set; }
|
|
<# } #>
|
|
}
|
|
}
|
|
|