1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 03:17:28 +08:00
Commit Graph

1151 Commits

Author SHA1 Message Date
Bartłomiej Dach
dc96c4888b
Add support for creating new blank difficulties 2022-02-02 21:55:33 +01:00
Bartłomiej Dach
a378e78ced
Fix RealmLive unnecessarily passing ID around
Appears to have never been needed. When the `retrieveFromID` method was
created in 81b5717ae7, it didn't use the
`id` parameter for anything either.
2022-02-01 21:35:12 +01:00
Dean Herbert
1a14ccc7ee Run EF migrations before migrating to realm
Turns out that there are more than zero users that are upgrading from
old databases. I think we probably want to support this for now.

Tested against database in https://github.com/ppy/osu/discussions/16700
and one other I had locally, both work correctly.
2022-01-29 23:13:23 +09:00
Dean Herbert
942ea896f1 Skip scores missing beatmaps during realm migration 2022-01-28 01:20:32 +09:00
Dean Herbert
81461be49f Skip beatmap imports where ruleset is not present in realm
Closes #16651.

When a ruleset is not available, the `Find` call would return null. When
a null is passed to the constructor, `BeatmapInfo` would create an "osu"
ruleset, which tries to get stored to realm and fails on duplicate
primary key.

Probably need to add better safeties against this (or change that
constructor...) but this will fix the migration process.

Probably not serious enough to pull the build. This only affects
rulesets like karaoke which have custom beatmaps.
2022-01-28 00:14:20 +09:00
Dan Balasescu
9ff2b9eb95
Merge pull request #16640 from peppy/realm-migration-always-delete
Improve realm migration UX to give users a recovery path on error
2022-01-27 15:43:14 +09:00
Dean Herbert
67ccb87992 Add exception message to discussion template url 2022-01-27 14:56:04 +09:00
Dean Herbert
fb081384e1 Add safety against zip creation potentially failing (probably can't but still) 2022-01-27 14:55:52 +09:00
Dean Herbert
465e7d29fe Avoid showing the external link warning 2022-01-27 14:53:11 +09:00
Dean Herbert
31abb372e5 Automatically zip and show the backup archive to the user 2022-01-27 14:52:58 +09:00
Dean Herbert
b745252962 Show notification when migration fails to give users a recovery path 2022-01-27 14:39:11 +09:00
Dean Herbert
deb5d75b5f Change migration process to always delete old EF database
It is already backed up, so this is probably fine.
2022-01-27 14:33:46 +09:00
Dean Herbert
587c0f965c Add more attempts to delete EF database
Just noticed in passing. Probably best we do this since it was known to
fail on windows in some rare cases.
2022-01-27 14:32:21 +09:00
Dean Herbert
f21e3d0d86 Block collection loading until realm migration has completed 2022-01-27 00:34:51 +09:00
Dan Balasescu
94d3e2c90c
Merge branch 'master' into fix-out-of-order-events-on-block-fail 2022-01-26 19:08:55 +09:00
Dan Balasescu
b1a23486c5
Merge pull request #16626 from peppy/fix-skin-section-realm-usage
Refactor `SkinSection` to avoid unnecessary realm queries
2022-01-26 19:01:15 +09:00
Dean Herbert
45636ce04b Remove collection ToLive helper method to avoid confusion 2022-01-26 18:26:37 +09:00
Dean Herbert
3aa681005b Skip importing scores which have no matching realm ruleset
There's no real way to recover these unless we want to start importing
rulesets into realm. And that seems counter productive. This can only
happen if users don't have the dll present any more, and it was removed
far before realm was tracking rulesets (else it would have an
`Available=0` entry in realm to match).
2022-01-26 18:04:54 +09:00
Dean Herbert
885fb92aad Move final empty result set sending to post-compact 2022-01-26 17:21:57 +09:00
Dean Herbert
791ea0308f Add flag to guard against deadlocks during blocking operations 2022-01-26 17:09:28 +09:00
Dean Herbert
11f0f3c17d Revert "Move final result set firing to before the update realm is disposed"
This reverts commit 24bcba6418.
2022-01-26 16:21:24 +09:00
Dean Herbert
24bcba6418 Move final result set firing to before the update realm is disposed
Without this, if any registered callback attempts to access
`RealmAccess.Realm` when handling the empty set callback, it will
deadlock the game.
2022-01-26 15:57:06 +09:00
Dean Herbert
5ea781faef Send unsubscribe actions to synchronization context for consistency and safety 2022-01-26 15:24:53 +09:00
Dean Herbert
91e0d1021f Merge branch 'master' into fix-out-of-order-events-on-block-fail 2022-01-26 15:21:10 +09:00
Dean Herbert
cd71ec0edd Remove ILive<> interface (and use abstract Live<> instead) 2022-01-26 13:38:56 +09:00
Dean Herbert
d37c3c463e Move statistics to static class 2022-01-26 13:29:12 +09:00
Dean Herbert
c7947b3489 Add statistics for Live usage 2022-01-26 12:42:24 +09:00
Dean Herbert
56b06f34f0 Fix RealmLive not refetching if update thread context was closed at some point 2022-01-26 12:32:34 +09:00
Dean Herbert
d76822b685 Avoid creating realm contexts or refetching when accessing RealmLive from the update thread 2022-01-26 12:32:34 +09:00
Dean Herbert
4a9f4eecba Use blocking calls to SynchronizationContext to guarantee order of execution 2022-01-25 20:49:52 +09:00
Dan Balasescu
d8270fe14f
Merge pull request #16604 from peppy/less-async-import
Remove `Task` from the inner-most `Import` method in `RealmArchiveModelImporter`
2022-01-25 16:47:07 +09:00
Dean Herbert
1bb1366c9f Fix notification reset events potentially arriving out of order if a block operation times out 2022-01-25 16:26:06 +09:00
Dan Balasescu
7f2e66298b
Merge branch 'master' into realm-subscription-tracking 2022-01-25 16:03:21 +09:00
Dean Herbert
778d2a71b4 Remove Task from the inner-most Import method in RealmArchiveModelImporter
One of my pending work items for post-realm merge.

The lowest-level import task is no longer asynchronous, as we don't want
it to span multiple threads to allow easier interaction with realm.
Removing the `Task` spec simplifies a heap of usages.

Individual usages should decide whether they want to run the import
asynchronously, by either using an alternative override or spooling up a
thread themselves.
2022-01-25 15:30:29 +09:00
Dean Herbert
5fb9b58c9b Add tracking of total subscriptions 2022-01-25 14:51:41 +09:00
Dean Herbert
9ad4d66e4d Merge branch 'realm-clean-up' into realm-block-timeout-assert-failure 2022-01-25 13:58:36 +09:00
Dean Herbert
a5c76a9647 Fix a few more cases of "context" terminology usage 2022-01-25 13:56:47 +09:00
Dean Herbert
d7342880f5 Update remaining cases of clashes with realm.Write and realm.RegisterForNotifications 2022-01-25 13:09:48 +09:00
Dean Herbert
e23b10e6a5 Update remaining cases of clashing variable name in realm.Run(realm.. 2022-01-25 13:04:05 +09:00
Dean Herbert
6f4c337a56 Fix a failed BlockAllOperations leaving update realm in unretrieved state
If the operation timed out on..

```csharp
   throw new TimeoutException(@"Took too long to acquire lock");
```

..from an update thread, it would not restore the update context.

The next call would then fail on the assert that ensures a non-null
context in such cases.

Can add test coverage if required.
2022-01-24 20:53:29 +09:00
Dean Herbert
f30894840c Update terminology to realm "instance" rather than "context"
This matches the terminology used by realm themselves, which feels
better.
2022-01-24 20:38:38 +09:00
Dean Herbert
6eb2c28e41 Rename RealmContextFactory to RealmAccess 2022-01-24 20:38:07 +09:00
Dan Balasescu
bb54ad9ad8
Merge pull request #16547 from peppy/realm-stable-subscriptions
Fix realm subscriptions getting lost after a context recycle
2022-01-24 20:20:04 +09:00
Dean Herbert
66c5d77d63 Allow realm migration to run again if interrupted halfway 2022-01-24 18:55:15 +09:00
Dean Herbert
9afa034296 Fix attempt to revive update thread realm context from non-update thread 2022-01-24 18:36:16 +09:00
Dean Herbert
9ff9611296 Merge branch 'master' into realm-stable-subscriptions 2022-01-24 18:25:47 +09:00
Dean Herbert
e3083c2477 Fix copy pasted xmldoc 2022-01-24 18:05:30 +09:00
Dean Herbert
bf5bf8d1fd Rename dictionaries to match methods 2022-01-24 17:58:53 +09:00
Dean Herbert
f4e7211ef1 Add xmldoc for RegisterForNotifications 2022-01-24 17:52:36 +09:00
Dean Herbert
abf14f0982 Lock unregistration for sanity 2022-01-24 17:46:53 +09:00
Dean Herbert
52cd906af6 Move context retrieval inside lock 2022-01-24 17:45:31 +09:00
Dean Herbert
cb319cebdb Refactor naming and add more comments to help understanding in RealmContextFactory subscription logic 2022-01-24 14:48:55 +09:00
Dean Herbert
40aa873190 Rename register methods to better explain their purpose 2022-01-24 14:37:36 +09:00
Dean Herbert
997c13f643 Add locking over realmSubscriptionsResetMap for sanity 2022-01-24 13:36:51 +09:00
Dean Herbert
deb1670862 Use Array.Empty instead of constructed list 2022-01-23 23:18:50 +09:00
Dean Herbert
249f0f9697
Add more lengthy comment explaining cyclic avoidance
Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
2022-01-23 23:15:39 +09:00
Dean Herbert
5e7993c35a Post disposal to synchronisation context 2022-01-23 20:43:25 +09:00
Dean Herbert
61cef42be9 Proof of concept realm subscriptions via Register 2022-01-23 20:28:04 +09:00
Dean Herbert
f39ff1eacb Add unregistration on blocking
This is the first part of the requirement of sending a `ChangeSet` event
to ensure correct state during blocking time
2022-01-23 20:27:57 +09:00
Dean Herbert
70a120ea8a Add missing lock coverage when using subscriptionActions dictionary 2022-01-23 18:00:24 +09:00
Bartłomiej Dach
7e68371d28
Move log statement about migration completed closer to rest of migration code 2022-01-22 14:20:28 +01:00
Bartłomiej Dach
1b2cca4a0d
Merge branch 'master' into realm-migration-ui 2022-01-22 13:52:19 +01:00
Bartłomiej Dach
c99f227879
Remove no longer used resolved storage 2022-01-22 13:48:49 +01:00
Dean Herbert
6a076a684e Merge branch 'realm-context-use-update-when-feasible' into realm-stable-subscriptions 2022-01-22 13:14:25 +09:00
Dean Herbert
cdcf0947e6 Merge branch 'master' into realm-context-use-update-when-feasible 2022-01-22 12:09:18 +09:00
Dean Herbert
b23f4674b1
Update outdated exception message
Co-authored-by: Salman Ahmed <frenzibyte@gmail.com>
2022-01-22 12:02:18 +09:00
Dean Herbert
daed0b04dc Remove using statements 2022-01-22 11:54:40 +09:00
Dean Herbert
855ef3fa92 Create backup before any realm contexts are used 2022-01-22 11:52:46 +09:00
Dean Herbert
8ef50ff42d Add safety to ensure RealmLiveUnmanaged is not used with managed instances 2022-01-22 02:13:08 +09:00
Dean Herbert
ad3a01dc06 Use a more reliable method of reviving the update thread realm after blocking 2022-01-21 22:44:56 +09:00
Dean Herbert
3b11235d3c Fix potentially cyclic subscription registration if a subscription's delegate accesses Context 2022-01-21 20:45:10 +09:00
Dean Herbert
1f157d729d Update existing subscriptions to new style
Fix missing detach calls in `MusicController`
2022-01-21 20:05:03 +09:00
Dean Herbert
45aea9add5 Implement full subscription flow 2022-01-21 19:06:23 +09:00
Dean Herbert
18bf690a30 Add Register method for subscription purposes and update safeties 2022-01-21 19:06:18 +09:00
Dean Herbert
8f1dfa33a2 Merge branch 'master' into realm-context-use-update-when-feasible 2022-01-21 18:03:09 +09:00
Dean Herbert
81b5717ae7 Fix RealmLive failing to retrieve due to lack of refresh 2022-01-21 17:33:03 +09:00
Dean Herbert
d2655c0825 Fix RealmLive not necessarily being in refreshed state due to potentially using update context 2022-01-21 17:27:30 +09:00
Dean Herbert
114c9e8c1f Update all usages of CreateContext to use either Run or Write 2022-01-21 17:27:08 +09:00
Dean Herbert
da0a803e6c Add RealmContextFactory.Write helper method 2022-01-21 17:08:05 +09:00
Dean Herbert
a59105635e Make CreateContext private 2022-01-21 16:40:20 +09:00
Dean Herbert
dde10d1ba2 Remove unused IRealmFactory interface 2022-01-21 16:38:07 +09:00
Dean Herbert
5622d2ba4f Show realm migration progress at Loader 2022-01-21 14:56:49 +09:00
Dean Herbert
0c9eb3ad61 Add realm factory helper methods to run work on the correct context
Avoids constructing a new `Realm` instance when called from the update
thread without worrying about disposal.
2022-01-21 01:33:47 +09:00
Dean Herbert
7aad2780b1 Add retry logic for realm backup creation 2022-01-21 00:46:53 +09:00
Dean Herbert
079b2dfc42 Create backup of databases before opening contexts
Attempt to avoid file IO issues.

Closes #16531.
2022-01-21 00:46:53 +09:00
Dean Herbert
5df46d0a54 Remove all calls to Realm.Refresh to fix blocking overhead from subscriptions
Turns out this is not required if realm is aware of a
`SynchronizationContext`. See
https://github.com/realm/realm-dotnet/discussions/2775#discussioncomment-2005412
for further reading.
2022-01-20 20:23:18 +09:00
Dean Herbert
ccddf9b47d Avoid constructor overhead for realm BeatmapSetInfo parameterless constructor 2022-01-20 17:03:44 +09:00
Dan Balasescu
64fe7d8dd3
Merge pull request #16520 from peppy/refresh-after-migrate
Improve realm migration performance further
2022-01-20 14:38:23 +09:00
Dean Herbert
a27a3b308c Remove duplicate setters 2022-01-20 04:34:00 +09:00
Dean Herbert
fad66d7682 Backup collections alongside main databases when migrating to realm 2022-01-19 16:31:36 +09:00
Dean Herbert
aa93042aa3 Centralise backup code and also run on skin/settings migrations 2022-01-19 16:31:36 +09:00
Dean Herbert
fd5198d667 Avoid using parameterless constructors in migration code
Minor performance improvement (less garbage).
2022-01-19 16:22:18 +09:00
Dean Herbert
42736c9995 Add transactional committing of scores/beatmaps
This helps slightly with performance, allows better monitoring via realm
studio, but most importantly greatly reduces filesize.

fully compacted:        109M
transaction size 100:   115M
transaction size 1000:  123M
transaction size 10000: 164M
single transaction:     183M

With a transaction size of 100 there is a performance reduction, so 1000
seems to be the best middle-ground.
2022-01-19 16:08:48 +09:00
Dean Herbert
973836484c Avoid using a write context for EF migration
This reduces a stall delay as EF tries to process changes over tracked
objects during disposal of the context.
2022-01-19 15:56:58 +09:00
Dean Herbert
faec62be51 Force a realm refresh after migration
This really shouldn't have much effect as it will be run in the first
`Update` method and is probably a noop (we are already pointing to the
newest version due to just performing writes), but seems like a safe addition.

In general `Realm.Refresh()` only really does anything when there's multithreaded
usage and notifications to be sent.
2022-01-19 15:56:58 +09:00
Dan Balasescu
fdf65aa2ff
Merge pull request #16502 from peppy/realm/remove-ef-migrations
Remove all EF migrations and helper methods
2022-01-19 14:43:45 +09:00
Dan Balasescu
3407b34b11
Merge branch 'master' into realm/remove-ef-migrations 2022-01-19 14:01:34 +09:00
Dan Balasescu
0b1736def6
Merge branch 'master' into realm-integration/faster-migration 2022-01-19 13:54:14 +09:00
Dan Balasescu
9c8f7795b7
Merge pull request #16510 from peppy/optimise-set-detach-part-2
Avoid file retrieval overhead when detaching `BeatmapSetInfo`
2022-01-19 13:53:34 +09:00
Dan Balasescu
a0336c6fc2
Merge pull request #16495 from peppy/realm-integration/reinit-on-corrupt
Add support for starting with a fresh realm database if the existing one is not usable
2022-01-19 13:30:14 +09:00
Dan Balasescu
2556f1cb87
Merge branch 'master' into optimise-set-detach-part-2 2022-01-19 13:20:38 +09:00
Dan Balasescu
d663fcd045
Merge pull request #16508 from peppy/optimise-set-detach
Create separate automapper configurations to reduce cyclic detach overhead
2022-01-19 13:20:25 +09:00
Dean Herbert
d440197fb3 Merge branch 'master' into realm-integration/faster-migration 2022-01-19 12:56:42 +09:00
Dean Herbert
ad4d9789ad Merge branch 'master' into realm-integration/reinit-on-corrupt 2022-01-19 12:31:56 +09:00
Dan Balasescu
f6f44029e8
Merge pull request #16507 from peppy/more-ingore-rules
Add some missing `IgnoredAttributes` to reduce automapper overhead
2022-01-19 12:26:37 +09:00
Dean Herbert
fb558a3189 Merge branch 'master' into realm-integration/reinit-on-corrupt 2022-01-19 12:26:24 +09:00
Dan Balasescu
c52899b1fb Rename property 2022-01-19 11:56:44 +09:00
Dean Herbert
261b4988f9 Only catch RealmExceptions to avoid blocking the nested TimeoutException 2022-01-19 10:58:59 +09:00
Dean Herbert
195534a1d2 Only output "successful" messages when copy actually occurred 2022-01-19 10:31:13 +09:00
Dean Herbert
e1a35714be Add notification for debug builds when database migration occurs 2022-01-19 10:31:10 +09:00
Dean Herbert
04e9ffa966 Freshen some comments 2022-01-19 10:20:56 +09:00
Dean Herbert
64a023665e Avoid taking more than one backup per migration run 2022-01-19 10:20:56 +09:00
Dean Herbert
761e161eec Add comment explaining ignore rule 2022-01-19 09:44:21 +09:00
Dean Herbert
60b80c88b6 Avoid file retrieval overhead when detaching BeatmapSetInfo
It seems that no usages of `BeatmapSetInfo` detaches require files - a
`WorkingBeatmap` is always obtained before doing further lookups.

Therefore we can omit this include unless the detaching object is a
`BeatmapInfo`. A refetch is performed when retrieving a
`WorkingBeatmap` to complete the equation.
2022-01-19 00:49:18 +09:00
Dean Herbert
f2b151023e Create separate automapper configurations to reduce cyclic detach overhead
This optimises the `BeatmapSetInfo` detach operation by avoiding
detaching `BeatmapSetInfo.Beatmaps[].BeatmapSetInfo` a second time over.
2022-01-19 00:03:24 +09:00
Dean Herbert
67bf95bc91 Remove all usage of AuthorString 2022-01-18 23:30:40 +09:00
Dean Herbert
6b0bf38c93 Use a single EF context to avoid scores getting cascade deleted along the way 2022-01-18 20:47:53 +09:00
Dean Herbert
6ddd2d59d3 Remove EF helper methods 2022-01-18 20:44:26 +09:00
Dean Herbert
519f7e6ad2 Don't bother with removing from EF as the file is going to be deleted anyway 2022-01-18 19:17:47 +09:00
Dean Herbert
3b0977903b Use IQueryable directly to avoid insane overheads 2022-01-18 19:17:47 +09:00
Dean Herbert
49fcff190a
Merge branch 'master' into realm-integration/reinit-on-corrupt 2022-01-18 18:02:23 +09:00
Dean Herbert
7baada2fa6
Merge branch 'master' into realm-integration/safer-migration 2022-01-18 18:01:46 +09:00
Dean Herbert
246a4a4bfe Add support for starting with a fresh realm database if the existing one is not usable
The most common scenario is switching between schema versions when
testing. This should alleviate the manual overhead of that for the
majority of cases.

For users, this will show a notification on startup if their database
was purged, similar to what we had with EF.
2022-01-18 16:05:13 +09:00
Dean Herbert
9a43ed742b Update automapper spec in line with v11
See https://docs.automapper.org/en/latest/11.0-Upgrade-Guide.html for
 more details.
2022-01-18 15:23:28 +09:00
Dean Herbert
1b62a685f3 Merge branch 'master' into realm-integration/score-and-beatmaps 2022-01-18 15:07:59 +09:00
Dean Herbert
3429fd8768 Fix transaction scope and add even more logging 2022-01-18 14:47:00 +09:00
Dean Herbert
bf50a9b8f8 Also backup the realm database before migration 2022-01-18 14:30:41 +09:00
Dean Herbert
2b1c15b6cc Allow BlockAllOperations to be called from a non-update thread if update has never run 2022-01-18 14:30:32 +09:00
Dean Herbert
cf30d48721 Add more logging during migration process 2022-01-18 14:21:33 +09:00
Dean Herbert
798482c941 Create backups before deleting scores and beatmaps from EF database 2022-01-18 14:21:33 +09:00
Dean Herbert
b1a75ce480 Permanently delete client.db after migration completes 2022-01-18 14:17:43 +09:00
Dean Herbert
a714941f93 Rename EF variable to make reading code easier 2022-01-18 14:06:22 +09:00
Dean Herbert
a7db793d8c Specify realm pipe path location
I can't confirm this works yet, since I'm not sure what the
preconditions are for the `.note` file to be created. What I can confirm
is that a `.note` file hasn't appeared in my game data directory yet.
2022-01-18 11:43:23 +09:00
Dean Herbert
2f2c498477 Fix importer not considering that some EF beatmaps have no local metadata 2022-01-14 23:31:42 +09:00
Dean Herbert
2840a71dda Uncomment EF deletion lines in migrations 2022-01-13 18:28:00 +09:00
Dean Herbert
b610d2db12 Add EF to realm beatmap migration 2022-01-13 18:23:18 +09:00
Dean Herbert
45a23e5a43 Add EF to realm score migration 2022-01-13 18:23:18 +09:00
Dean Herbert
c61419dfe5 Fix scores not using correct filename/display strings
I've updated all cases where we should have been using
`GetDisplayString()` anyway, but left the `ToString()` implementations
in place for safety. They should probably be removed in the future.
2022-01-13 16:56:11 +09:00
Dean Herbert
dcc354aa7c Fix deleted scores not being cleaned up on next startup 2022-01-13 13:40:09 +09:00
Dean Herbert
7a81fe19f6 Bump realm schema version to allow upgrades 2022-01-13 13:28:46 +09:00
Dean Herbert
7baff18764 Add back PerformRead return safety by checking IsManaged status of returned data 2022-01-13 13:14:44 +09:00
Dean Herbert
085893c9b4 Fix stray bracket 2022-01-13 13:03:57 +09:00
Dean Herbert
e12025dd48 Cascade delete metadata when beatmaps are deleted 2022-01-12 17:49:11 +09:00
Dean Herbert
5f7365e8f3 Ensure scores are cleaned up alongside beatmap so they don't have a null reference 2022-01-12 17:49:11 +09:00
Dean Herbert
f24b2b1be3 Make copying detached changes to realm only exposed for BeatmapSet
Also fixes remaining issues with the copy process.
2022-01-12 17:49:11 +09:00
Dean Herbert
a4de0f93fa Move manager Update methods to be explicit to where they are still used by legacy code
Also fixes skin hash repopulation being completely broken.
2022-01-12 17:49:11 +09:00
Dean Herbert
580ad03f8d Combine mapper configurations and add more explanation about special cases 2022-01-12 17:49:11 +09:00
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
Dean Herbert
e0c59f4b3c Localise EF context factory usage to migration only 2022-01-12 17:49:11 +09:00
Dean Herbert
f986c3ebd4 Add basic write support via automapper 2022-01-12 17:49:11 +09:00