Rename EF classes to allow for shit to hit the fan

This commit is contained in:
Dean Herbert 2021-11-19 18:59:14 +09:00
parent c383f26729
commit 0b6c4497bd
7 changed files with 49 additions and 49 deletions

View File

@ -6,7 +6,7 @@ using osu.Game.Database;
namespace osu.Game.Beatmaps namespace osu.Game.Beatmaps
{ {
public class BeatmapDifficulty : IHasPrimaryKey, IBeatmapDifficultyInfo public class EFBeatmapDifficulty : IHasPrimaryKey, IBeatmapDifficultyInfo
{ {
/// <summary> /// <summary>
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>. /// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
@ -23,11 +23,11 @@ namespace osu.Game.Beatmaps
private float? approachRate; private float? approachRate;
public BeatmapDifficulty() public EFBeatmapDifficulty()
{ {
} }
public BeatmapDifficulty(IBeatmapDifficultyInfo source) public EFBeatmapDifficulty(IBeatmapDifficultyInfo source)
{ {
CopyFrom(source); CopyFrom(source);
} }
@ -42,11 +42,11 @@ namespace osu.Game.Beatmaps
public double SliderTickRate { get; set; } = 1; public double SliderTickRate { get; set; } = 1;
/// <summary> /// <summary>
/// Returns a shallow-clone of this <see cref="BeatmapDifficulty"/>. /// Returns a shallow-clone of this <see cref="EFBeatmapDifficulty"/>.
/// </summary> /// </summary>
public BeatmapDifficulty Clone() public EFBeatmapDifficulty Clone()
{ {
var diff = (BeatmapDifficulty)Activator.CreateInstance(GetType()); var diff = (EFBeatmapDifficulty)Activator.CreateInstance(GetType());
CopyTo(diff); CopyTo(diff);
return diff; return diff;
} }
@ -62,7 +62,7 @@ namespace osu.Game.Beatmaps
SliderTickRate = other.SliderTickRate; SliderTickRate = other.SliderTickRate;
} }
public virtual void CopyTo(BeatmapDifficulty other) public virtual void CopyTo(EFBeatmapDifficulty other)
{ {
other.ApproachRate = ApproachRate; other.ApproachRate = ApproachRate;
other.DrainRate = DrainRate; other.DrainRate = DrainRate;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps
{ {
[ExcludeFromDynamicCompile] [ExcludeFromDynamicCompile]
[Serializable] [Serializable]
public class BeatmapInfo : IEquatable<BeatmapInfo>, IHasPrimaryKey, IBeatmapInfo public class EFBeatmapInfo : IEquatable<EFBeatmapInfo>, IHasPrimaryKey, IBeatmapInfo
{ {
public int ID { get; set; } public int ID { get; set; }
@ -40,14 +40,14 @@ namespace osu.Game.Beatmaps
public BeatmapOnlineStatus Status { get; set; } = BeatmapOnlineStatus.None; public BeatmapOnlineStatus Status { get; set; } = BeatmapOnlineStatus.None;
[Required] [Required]
public BeatmapSetInfo BeatmapSet { get; set; } public EFBeatmapSetInfo BeatmapSet { get; set; }
public BeatmapMetadata Metadata { get; set; } public EFBeatmapMetadata Metadata { get; set; }
[JsonIgnore] [JsonIgnore]
public int BaseDifficultyID { get; set; } public int BaseDifficultyID { get; set; }
public BeatmapDifficulty BaseDifficulty { get; set; } public EFBeatmapDifficulty BaseDifficulty { get; set; }
[NotMapped] [NotMapped]
public APIBeatmap OnlineInfo { get; set; } public APIBeatmap OnlineInfo { get; set; }
@ -86,7 +86,7 @@ namespace osu.Game.Beatmaps
public int RulesetID { get; set; } public int RulesetID { get; set; }
public RulesetInfo Ruleset { get; set; } public EFRulesetInfo Ruleset { get; set; }
public bool LetterboxInBreaks { get; set; } public bool LetterboxInBreaks { get; set; }
public bool WidescreenStoryboard { get; set; } public bool WidescreenStoryboard { get; set; }
@ -131,7 +131,7 @@ namespace osu.Game.Beatmaps
public override string ToString() => this.GetDisplayTitle(); public override string ToString() => this.GetDisplayTitle();
public bool Equals(BeatmapInfo other) public bool Equals(EFBeatmapInfo other)
{ {
if (ReferenceEquals(this, other)) return true; if (ReferenceEquals(this, other)) return true;
if (other == null) return false; if (other == null) return false;
@ -142,20 +142,20 @@ namespace osu.Game.Beatmaps
return false; return false;
} }
public bool Equals(IBeatmapInfo other) => other is BeatmapInfo b && Equals(b); public bool Equals(IBeatmapInfo other) => other is EFBeatmapInfo b && Equals(b);
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && public bool AudioEquals(EFBeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Hash == other.BeatmapSet.Hash && BeatmapSet.Hash == other.BeatmapSet.Hash &&
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && public bool BackgroundEquals(EFBeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Hash == other.BeatmapSet.Hash && BeatmapSet.Hash == other.BeatmapSet.Hash &&
(Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile; (Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile;
/// <summary> /// <summary>
/// Returns a shallow-clone of this <see cref="BeatmapInfo"/>. /// Returns a shallow-clone of this <see cref="EFBeatmapInfo"/>.
/// </summary> /// </summary>
public BeatmapInfo Clone() => (BeatmapInfo)MemberwiseClone(); public EFBeatmapInfo Clone() => (EFBeatmapInfo)MemberwiseClone();
#region Implementation of IHasOnlineID #region Implementation of IHasOnlineID
@ -166,7 +166,7 @@ namespace osu.Game.Beatmaps
#region Implementation of IBeatmapInfo #region Implementation of IBeatmapInfo
[JsonIgnore] [JsonIgnore]
IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata ?? BeatmapSet?.Metadata ?? new BeatmapMetadata(); IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata ?? BeatmapSet?.Metadata ?? new EFBeatmapMetadata();
[JsonIgnore] [JsonIgnore]
IBeatmapDifficultyInfo IBeatmapInfo.Difficulty => BaseDifficulty; IBeatmapDifficultyInfo IBeatmapInfo.Difficulty => BaseDifficulty;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps
{ {
[ExcludeFromDynamicCompile] [ExcludeFromDynamicCompile]
[Serializable] [Serializable]
public class BeatmapMetadata : IEquatable<BeatmapMetadata>, IHasPrimaryKey, IBeatmapMetadataInfo public class EFBeatmapMetadata : IEquatable<EFBeatmapMetadata>, IHasPrimaryKey, IBeatmapMetadataInfo
{ {
public int ID { get; set; } public int ID { get; set; }
@ -33,10 +33,10 @@ namespace osu.Game.Beatmaps
public string ArtistUnicode { get; set; } = string.Empty; public string ArtistUnicode { get; set; } = string.Empty;
[JsonIgnore] [JsonIgnore]
public List<BeatmapInfo> Beatmaps { get; set; } = new List<BeatmapInfo>(); public List<EFBeatmapInfo> Beatmaps { get; set; } = new List<EFBeatmapInfo>();
[JsonIgnore] [JsonIgnore]
public List<BeatmapSetInfo> BeatmapSets { get; set; } = new List<BeatmapSetInfo>(); public List<EFBeatmapSetInfo> BeatmapSets { get; set; } = new List<EFBeatmapSetInfo>();
/// <summary> /// <summary>
/// The author of the beatmaps in this set. /// The author of the beatmaps in this set.
@ -81,7 +81,7 @@ namespace osu.Game.Beatmaps
public string BackgroundFile { get; set; } = string.Empty; public string BackgroundFile { get; set; } = string.Empty;
public bool Equals(BeatmapMetadata other) => ((IBeatmapMetadataInfo)this).Equals(other); public bool Equals(EFBeatmapMetadata other) => ((IBeatmapMetadataInfo)this).Equals(other);
public override string ToString() => this.GetDisplayTitle(); public override string ToString() => this.GetDisplayTitle();

View File

@ -14,7 +14,7 @@ using osu.Game.Extensions;
namespace osu.Game.Beatmaps namespace osu.Game.Beatmaps
{ {
[ExcludeFromDynamicCompile] [ExcludeFromDynamicCompile]
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>, IBeatmapSetInfo public class EFBeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<EFBeatmapSetInfo>, IBeatmapSetInfo
{ {
public int ID { get; set; } public int ID { get; set; }
@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps
public DateTimeOffset DateAdded { get; set; } public DateTimeOffset DateAdded { get; set; }
public BeatmapMetadata Metadata { get; set; } public EFBeatmapMetadata Metadata { get; set; }
[NotNull] [NotNull]
public List<BeatmapInfo> Beatmaps { get; } = new List<BeatmapInfo>(); public List<BeatmapInfo> Beatmaps { get; } = new List<BeatmapInfo>();
@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps
public bool Protected { get; set; } public bool Protected { get; set; }
public bool Equals(BeatmapSetInfo other) public bool Equals(EFBeatmapSetInfo other)
{ {
if (ReferenceEquals(this, other)) return true; if (ReferenceEquals(this, other)) return true;
if (other == null) return false; if (other == null) return false;
@ -85,7 +85,7 @@ namespace osu.Game.Beatmaps
return false; return false;
} }
public bool Equals(IBeatmapSetInfo other) => other is BeatmapSetInfo b && Equals(b); public bool Equals(IBeatmapSetInfo other) => other is EFBeatmapSetInfo b && Equals(b);
#region Implementation of IHasOnlineID #region Implementation of IHasOnlineID

View File

@ -19,12 +19,12 @@ namespace osu.Game.Database
{ {
public class OsuDbContext : DbContext public class OsuDbContext : DbContext
{ {
public DbSet<BeatmapInfo> BeatmapInfo { get; set; } public DbSet<EFBeatmapInfo> EFBeatmapInfo { get; set; }
public DbSet<BeatmapDifficulty> BeatmapDifficulty { get; set; } public DbSet<EFBeatmapDifficulty> BeatmapDifficulty { get; set; }
public DbSet<BeatmapMetadata> BeatmapMetadata { get; set; } public DbSet<EFBeatmapMetadata> BeatmapMetadata { get; set; }
public DbSet<BeatmapSetInfo> BeatmapSetInfo { get; set; } public DbSet<EFBeatmapSetInfo> EFBeatmapSetInfo { get; set; }
public DbSet<FileInfo> FileInfo { get; set; } public DbSet<FileInfo> FileInfo { get; set; }
public DbSet<RulesetInfo> RulesetInfo { get; set; } public DbSet<EFRulesetInfo> RulesetInfo { get; set; }
public DbSet<EFSkinInfo> SkinInfo { get; set; } public DbSet<EFSkinInfo> SkinInfo { get; set; }
public DbSet<ScoreInfo> ScoreInfo { get; set; } public DbSet<ScoreInfo> ScoreInfo { get; set; }
@ -125,13 +125,13 @@ namespace osu.Game.Database
{ {
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);
modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.OnlineID).IsUnique(); modelBuilder.Entity<EFBeatmapInfo>().HasIndex(b => b.OnlineID).IsUnique();
modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.MD5Hash); modelBuilder.Entity<EFBeatmapInfo>().HasIndex(b => b.MD5Hash);
modelBuilder.Entity<BeatmapInfo>().HasIndex(b => b.Hash); modelBuilder.Entity<EFBeatmapInfo>().HasIndex(b => b.Hash);
modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.OnlineID).IsUnique(); modelBuilder.Entity<EFBeatmapSetInfo>().HasIndex(b => b.OnlineID).IsUnique();
modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.DeletePending); modelBuilder.Entity<EFBeatmapSetInfo>().HasIndex(b => b.DeletePending);
modelBuilder.Entity<BeatmapSetInfo>().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity<EFBeatmapSetInfo>().HasIndex(b => b.Hash).IsUnique();
modelBuilder.Entity<EFSkinInfo>().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity<EFSkinInfo>().HasIndex(b => b.Hash).IsUnique();
modelBuilder.Entity<EFSkinInfo>().HasIndex(b => b.DeletePending); modelBuilder.Entity<EFSkinInfo>().HasIndex(b => b.DeletePending);
@ -142,10 +142,10 @@ namespace osu.Game.Database
modelBuilder.Entity<FileInfo>().HasIndex(b => b.Hash).IsUnique(); modelBuilder.Entity<FileInfo>().HasIndex(b => b.Hash).IsUnique();
modelBuilder.Entity<FileInfo>().HasIndex(b => b.ReferenceCount); modelBuilder.Entity<FileInfo>().HasIndex(b => b.ReferenceCount);
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.Available); modelBuilder.Entity<EFRulesetInfo>().HasIndex(b => b.Available);
modelBuilder.Entity<RulesetInfo>().HasIndex(b => b.ShortName).IsUnique(); modelBuilder.Entity<EFRulesetInfo>().HasIndex(b => b.ShortName).IsUnique();
modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BaseDifficulty); modelBuilder.Entity<EFBeatmapInfo>().HasOne(b => b.BaseDifficulty);
modelBuilder.Entity<ScoreInfo>().HasIndex(b => b.OnlineID).IsUnique(); modelBuilder.Entity<ScoreInfo>().HasIndex(b => b.OnlineID).IsUnique();
} }

View File

@ -10,7 +10,7 @@ using osu.Framework.Testing;
namespace osu.Game.Rulesets namespace osu.Game.Rulesets
{ {
[ExcludeFromDynamicCompile] [ExcludeFromDynamicCompile]
public sealed class RulesetInfo : IEquatable<RulesetInfo>, IRulesetInfo public sealed class EFRulesetInfo : IEquatable<EFRulesetInfo>, IRulesetInfo
{ {
public int? ID { get; set; } public int? ID { get; set; }
@ -45,9 +45,9 @@ namespace osu.Game.Rulesets
return ruleset; return ruleset;
} }
public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; public bool Equals(EFRulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
public override bool Equals(object obj) => obj is RulesetInfo rulesetInfo && Equals(rulesetInfo); public override bool Equals(object obj) => obj is EFRulesetInfo rulesetInfo && Equals(rulesetInfo);
public bool Equals(IRulesetInfo other) => other is RulesetInfo b && Equals(b); public bool Equals(IRulesetInfo other) => other is RulesetInfo b && Equals(b);

View File

@ -789,7 +789,7 @@ See the LICENCE file in the repository root for full licence text.&#xD;
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String> <s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String> <s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CustomTools/CustomToolsData/@EntryValue"></s:String> <s:String x:Key="/Default/CustomTools/CustomToolsData/@EntryValue"></s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EDaemon_002ESettings_002EMigration_002ESwaWarningsModeSettingsMigrate/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFBeature_002EServices_002EDaemon_002ESettings_002EMigration_002ESwaWarningsModeSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>