mirror of
https://github.com/wangdage12/Snap.Hutao.git
synced 2026-07-31 04:10:25 +08:00
修正机器人审查的一些问题
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixCultivateEntryRelatedEntryOnDeleteSetNull : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_cultivate_entries_cultivate_entries_RelatedEntryId",
|
||||||
|
table: "cultivate_entries");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_cultivate_entries_cultivate_entries_RelatedEntryId",
|
||||||
|
table: "cultivate_entries",
|
||||||
|
column: "RelatedEntryId",
|
||||||
|
principalTable: "cultivate_entries",
|
||||||
|
principalColumn: "InnerId",
|
||||||
|
onDelete: ReferentialAction.SetNull);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_cultivate_entries_cultivate_entries_RelatedEntryId",
|
||||||
|
table: "cultivate_entries");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_cultivate_entries_cultivate_entries_RelatedEntryId",
|
||||||
|
table: "cultivate_entries",
|
||||||
|
column: "RelatedEntryId",
|
||||||
|
principalTable: "cultivate_entries",
|
||||||
|
principalColumn: "InnerId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -595,7 +595,8 @@ namespace Snap.Hutao.Migrations
|
|||||||
|
|
||||||
b.HasOne("Snap.Hutao.Model.Entity.CultivateEntry", "RelatedEntry")
|
b.HasOne("Snap.Hutao.Model.Entity.CultivateEntry", "RelatedEntry")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("RelatedEntryId");
|
.HasForeignKey("RelatedEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
|
||||||
b.Navigation("Project");
|
b.Navigation("Project");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace Snap.Hutao.Model.Entity.Configuration;
|
||||||
|
|
||||||
|
internal sealed class CultivateEntryConfiguration : IEntityTypeConfiguration<CultivateEntry>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<CultivateEntry> builder)
|
||||||
|
{
|
||||||
|
builder.HasOne(e => e.RelatedEntry)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(e => e.RelatedEntryId)
|
||||||
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,6 +90,7 @@ internal sealed partial class AppDbContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.ApplyConfiguration(new AvatarInfoConfiguration())
|
.ApplyConfiguration(new AvatarInfoConfiguration())
|
||||||
|
.ApplyConfiguration(new CultivateEntryConfiguration())
|
||||||
.ApplyConfiguration(new DailyNoteEntryConfiguration())
|
.ApplyConfiguration(new DailyNoteEntryConfiguration())
|
||||||
.ApplyConfiguration(new SpiralAbyssEntryConfiguration())
|
.ApplyConfiguration(new SpiralAbyssEntryConfiguration())
|
||||||
.ApplyConfiguration(new RoleCombatEntryConfiguration())
|
.ApplyConfiguration(new RoleCombatEntryConfiguration())
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ internal sealed partial class CultivationViewModel : Abstraction.ViewModel, IRec
|
|||||||
|
|
||||||
protected override async ValueTask<bool> LoadOverrideAsync(CancellationToken token)
|
protected override async ValueTask<bool> LoadOverrideAsync(CancellationToken token)
|
||||||
{
|
{
|
||||||
|
messenger.UnregisterAll(this);
|
||||||
|
messenger.Register<CultivationProjectEntriesChangedMessage>(this);
|
||||||
|
|
||||||
if (!await metadataService.InitializeAsync().ConfigureAwait(false))
|
if (!await metadataService.InitializeAsync().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -133,6 +136,7 @@ internal sealed partial class CultivationViewModel : Abstraction.ViewModel, IRec
|
|||||||
|
|
||||||
protected override void UninitializeOverride()
|
protected override void UninitializeOverride()
|
||||||
{
|
{
|
||||||
|
messenger.UnregisterAll(this);
|
||||||
using (Projects?.SuppressChangeCurrentItem())
|
using (Projects?.SuppressChangeCurrentItem())
|
||||||
{
|
{
|
||||||
Projects = default;
|
Projects = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user