更新控制器

This commit is contained in:
lzw
2021-10-15 14:45:16 +08:00
parent 9ce9d4ed98
commit 5ab4107ffa
9 changed files with 58 additions and 16 deletions

View File

@@ -12,7 +12,7 @@ namespace Yi.Framework.Model
{
//Add-Migration yi-1
//Update-Database yi-1
public class DataContext : DbContext
public partial class DataContext : DbContext
{
private readonly IOptionsMonitor<SqliteOptions> _optionsMonitor;
private readonly string _connStr;

View File

@@ -11,5 +11,24 @@
string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径
Assembly assembly = Assembly.LoadFrom(System.IO.Path.Combine(solutionsPath, @"Yi.Framework.ApiMicroservice\bin\Debug\net5.0\Yi.Framework.Model.dll"));
Type[] ts = assembly.GetTypes();
#>
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Model
{
public partial class BaseContext :DbContext
{
<# foreach(var item in ts){
#>
public DbSet<<#=item#>> <#=item#> { get; set; }
<# } #>
}
}

View File

@@ -8,14 +8,6 @@
<Folder Include="Search\" />
</ItemGroup>
<ItemGroup>
<None Include="T4DaraContext.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>T4DaraContext.tt</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.10" />
</ItemGroup>