This commit is contained in:
qianhao.xu 2025-04-01 14:02:10 +08:00
parent 8503d0f0a6
commit 4bb3441145
5 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,15 @@
[
{
"Name": "新建配置文件",
"Projects": [
{
"Path": "Server\\RIZO.Server.Start\\RIZO.Server.Start.csproj",
"Action": "Start"
},
{
"Path": "Client\\RIZO.Client.Start\\RIZO.Client.Start.csproj",
"Action": "Start"
}
]
}
]

View File

@ -9,6 +9,8 @@ namespace RIZO.Server.EFContext
{
_configuration = configuration;
}
public EFCoreContext CreateDBContext()
{
return new EFCoreContext(_configuration.Read("DBConnectStr"));

View File

@ -19,7 +19,10 @@ namespace RIZO.Server.EFCore
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(strConn);
//optionsBuilder.UseSqlServer(strConn);
// MySQL 配置(使用 Pomelo 提供程序)
optionsBuilder.UseMySql(strConn,
ServerVersion.AutoDetect(strConn));
}
protected override void OnModelCreating(ModelBuilder modelBuilder)

View File

@ -10,7 +10,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MySql.EntityFrameworkCore" Version="5.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
@ -18,4 +18,8 @@
<ProjectReference Include="..\RIZO.Server.Models\RIZO.Server.Models.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@ -7,7 +7,7 @@
}
},
"AllowedHosts": "*",
"DBConnectStr": "Server=127.0.0.1;Database=zx_sp_record;User Id=sa;Password=123456;",
"DBConnectStr": "Server=139.224.232.211;Database=rizo_xbp;User Id=root;Password=doantech123;Port=3308"
//"ConnectionStrings": {
// "MySqlConnection": "server=localhost;database=your_database;user=root;password=your_password"