1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00
osu-lazer/osu.Game
Salman Ahmed 6db3c32dd1 Handle automapper realm cyclic references via AfterMaps
This may not be the cleanest solution, but there don't seem to be any
way towards this either.

- `UseDestinationValue` has been inherited by default as noted in
https://docs.automapper.org/en/stable/10.0-Upgrade-Guide.html#usedestinationvalue-is-now-inherited-by-default, and its behaviour in this case would be using the nested **managed** realm object for the destination member rather than creating an unmanaged version.

- `MaxDepth` already sets `PreserveReferences` so there's no point of using it.

- `MaxDepth` should probably not be set for all maps, only for those with
cyclic references, to avoid the expensive overhead of `PreserveReferences`, as mentioned in https://docs.automapper.org/en/stable/5.0-Upgrade-Guide.html#circular-references.

That aside, `MaxDepth` should actually only be set to `1` for
`BeatmapSetInfo` mapping, because we don't want AutoMapper to create a
nested instance of `BeatmapSetInfo` in each mapped/detached beatmap, but
for some reason, doing that will cause automapper to not map any beatmap
inside the set and leave it with 0 beatmaps.

While on the other hand, using `MaxDepth(2)` for `BeatmapSetInfo` works,
but creates an unused instance of a `BeatmapSetInfo` inside each mapped
beatmap, which may not be ideal.

For `BeatmapInfo`, it has to be `MaxDepth(2)`, in which the first
`BeatmapInfo` depth would be itself (when detaching a beatmap), and the
second would be nested beatmaps inside the mapped/detached
`BeatmapSetInfo` within the beatmap. (note that when detaching a beatmap
set, the unused instance of `BeatmapSetInfo` within each beatmap of that
beatmap set doesn't also have a list of unused beatmaps as one might expect from the depth specification, it surprisingly has 0 beatmaps)

This causes it to create an unused instance of `BeatmapInfo` in the beatmap set resembling the root mapped/detached beatmap, but that one might be inevitable.
2022-01-12 17:49:11 +09:00
..
Audio Clean up unused resolved properties 2021-12-03 18:49:49 +09:00
Beatmaps Fix protected beatmap sets getting deleted 2022-01-12 17:49:11 +09:00
Collections BeatmapSetInfo detach support 2022-01-12 17:00:16 +09:00
Configuration Add migration of positional hitsounds setting to new level based setting 2022-01-03 12:46:20 +09:00
Database Handle automapper realm cyclic references via AfterMaps 2022-01-12 17:49:11 +09:00
Extensions Fix cursors sent to osu-web being potentially string formatted in incorrect culture 2022-01-04 17:20:46 +09:00
Graphics Rewrite storyboard clock management in slightly different way 2022-01-11 22:00:04 +01:00
Input Various updates to ruleset and primary key usages to move closer to realm support 2022-01-12 16:57:13 +09:00
IO Remove EF FileStore 2022-01-12 16:39:36 +09:00
IPC Update IPC usage to return null 2021-12-03 14:30:15 +09:00
Localisation Add button to compact realm on demand 2022-01-12 15:22:36 +09:00
Migrations Fix stray typo 2021-11-19 13:27:06 +09:00
Models Replace EF ScoreInfo with realm version 2022-01-12 16:57:27 +09:00
Online Fix most remaining test issues 2022-01-12 17:49:11 +09:00
Overlays Update MusicController to handle deletions more correctly 2022-01-12 17:49:11 +09:00
Performance Add LocalUserPlayInfo interface to convey common information about player status 2021-08-17 16:15:47 +09:00
Properties
Replays Add deep cloning support to Score/ScoreInfo/Replay 2021-07-19 14:14:28 +09:00
Rulesets Add RulesetInfo hashcode implementation and tidy up equality 2022-01-12 17:49:10 +09:00
Scoring Update null allowances across beatmaps and scores 2022-01-12 17:49:11 +09:00
Screens Fix song select import popup not always showing 2022-01-12 17:49:11 +09:00
Skinning Reimplmeent IsAvailableLocally as an abstract method 2022-01-12 17:49:10 +09:00
Stores Fix most remaining test issues 2022-01-12 17:49:11 +09:00
Storyboards Fix invalid DI resolution of RealmFileStore 2022-01-12 17:00:16 +09:00
Tests Add protections against test null refs when beatmap load fails 2022-01-12 17:49:11 +09:00
Updater Fix clear identifier typos 2021-12-27 20:26:28 -08:00
Users Add test for ranked/unranked user display 2021-12-19 13:40:22 +01:00
Utils Fix xmldoc reference 2021-11-17 11:46:06 +09:00
.editorconfig Add localisation license header to editorconfig 2021-08-02 11:44:10 +09:00
osu!.res
osu.Game.csproj Update framework 2022-01-11 15:09:51 +09:00
OsuGame.cs Detach rather than consume live when presenting a beatmap 2022-01-12 17:49:10 +09:00
OsuGameBase_Importing.cs Move import logic out to partial class 2021-05-28 02:44:44 +09:00
OsuGameBase.cs Localise EF context factory usage to migration only 2022-01-12 17:49:11 +09:00
PerformFromMenuRunner.cs