mirror of
https://github.com/wangdage12/Snap.Hutao.git
synced 2026-06-06 09:51:06 +08:00
修正机器人审查的一些问题
This commit is contained in:
@@ -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")
|
||||
.WithMany()
|
||||
.HasForeignKey("RelatedEntryId");
|
||||
.HasForeignKey("RelatedEntryId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
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
|
||||
.ApplyConfiguration(new AvatarInfoConfiguration())
|
||||
.ApplyConfiguration(new CultivateEntryConfiguration())
|
||||
.ApplyConfiguration(new DailyNoteEntryConfiguration())
|
||||
.ApplyConfiguration(new SpiralAbyssEntryConfiguration())
|
||||
.ApplyConfiguration(new RoleCombatEntryConfiguration())
|
||||
|
||||
@@ -103,6 +103,9 @@ internal sealed partial class CultivationViewModel : Abstraction.ViewModel, IRec
|
||||
|
||||
protected override async ValueTask<bool> LoadOverrideAsync(CancellationToken token)
|
||||
{
|
||||
messenger.UnregisterAll(this);
|
||||
messenger.Register<CultivationProjectEntriesChangedMessage>(this);
|
||||
|
||||
if (!await metadataService.InitializeAsync().ConfigureAwait(false))
|
||||
{
|
||||
return false;
|
||||
@@ -133,6 +136,7 @@ internal sealed partial class CultivationViewModel : Abstraction.ViewModel, IRec
|
||||
|
||||
protected override void UninitializeOverride()
|
||||
{
|
||||
messenger.UnregisterAll(this);
|
||||
using (Projects?.SuppressChangeCurrentItem())
|
||||
{
|
||||
Projects = default;
|
||||
|
||||
Reference in New Issue
Block a user