接受
This commit is contained in:
@@ -10,5 +10,6 @@ namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public int? is_top { get; set; }
|
||||
public int? sort { get; set; }
|
||||
public int? is_show { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ namespace Yi.Framework.Model
|
||||
optionsBuilder.UseSqlite(_connStr);
|
||||
}
|
||||
}
|
||||
public DbSet<user> user { get; set; }
|
||||
public DbSet<role> role { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Yi.Framework.Model.Models
|
||||
public string icon { get; set; }
|
||||
public string router { get; set; }
|
||||
public string menu_name { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public ICollection<menu> children { get; set; }
|
||||
|
||||
17
Yi.Framework/Yi.Framework.Model/T4DataContext.cs
Normal file
17
Yi.Framework/Yi.Framework.Model/T4DataContext.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
||||
{
|
||||
public DbSet<menu> menu { get; set; }
|
||||
public DbSet<mould> mould { get; set; }
|
||||
public DbSet<role> role { get; set; }
|
||||
public DbSet<user> user { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
39
Yi.Framework/Yi.Framework.Model/T4DataContext.tt
Normal file
39
Yi.Framework/Yi.Framework.Model/T4DataContext.tt
Normal file
@@ -0,0 +1,39 @@
|
||||
<#@ 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" #>
|
||||
<#
|
||||
|
||||
DirectoryInfo dir = new DirectoryInfo(@"D:\YiFramework\Yi\Yi.Framework\Yi.Framework.Model\Models\");
|
||||
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; }
|
||||
<# } #>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
<Folder Include="Search\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="T4DataContext.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>T4DataContext.tt</DependentUpon>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.11" />
|
||||
@@ -28,6 +36,10 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>T4DaraContext.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="T4DataContext.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>T4DataContext.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -40,6 +52,11 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>T4DaraContext.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="T4DataContext.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>T4DataContext.tt</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user