1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 17:52:56 +08:00

Move primary key attribute to IHasPrimaryKey

This commit is contained in:
smoogipoo 2018-11-28 13:19:23 +09:00
parent ea52d2d527
commit 14ff4bc26a
11 changed files with 11 additions and 20 deletions

View File

@ -1,19 +1,18 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using osu.Game.Database;
namespace osu.Game.Beatmaps
{
public class BeatmapDifficulty
public class BeatmapDifficulty : IHasPrimaryKey
{
/// <summary>
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
/// </summary>
public const float DEFAULT_DIFFICULTY = 5;
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int ID { get; set; }

View File

@ -15,7 +15,6 @@ namespace osu.Game.Beatmaps
[Serializable]
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable, IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int ID { get; set; }

View File

@ -6,14 +6,14 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Database;
using osu.Game.Users;
namespace osu.Game.Beatmaps
{
[Serializable]
public class BeatmapMetadata : IEquatable<BeatmapMetadata>
public class BeatmapMetadata : IEquatable<BeatmapMetadata>, IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public string Title { get; set; }

View File

@ -2,15 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using osu.Game.Database;
using osu.Game.IO;
namespace osu.Game.Beatmaps
{
public class BeatmapSetFileInfo : INamedFileInfo
public class BeatmapSetFileInfo : INamedFileInfo, IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public int BeatmapSetInfoID { get; set; }

View File

@ -10,7 +10,6 @@ namespace osu.Game.Beatmaps
{
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
private int? onlineBeatmapSetID;

View File

@ -9,7 +9,6 @@ namespace osu.Game.Configuration
[Table("Settings")]
public class DatabasedSetting : IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public int? RulesetID { get; set; }

View File

@ -1,10 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations.Schema;
namespace osu.Game.Database
{
public interface IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
int ID { get; set; }
}
}

View File

@ -1,14 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using osu.Game.Database;
namespace osu.Game.IO
{
public class FileInfo
public class FileInfo : IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public string Hash { get; set; }

View File

@ -10,7 +10,6 @@ namespace osu.Game.Input.Bindings
[Table("KeyBinding")]
public class DatabasedKeyBinding : KeyBinding, IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public int? RulesetID { get; set; }

View File

@ -2,15 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using osu.Game.Database;
using osu.Game.IO;
namespace osu.Game.Skinning
{
public class SkinFileInfo : INamedFileInfo
public class SkinFileInfo : INamedFileInfo, IHasPrimaryKey
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public int SkinInfoID { get; set; }

View File

@ -3,14 +3,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using osu.Game.Database;
namespace osu.Game.Skinning
{
public class SkinInfo : IHasFiles<SkinFileInfo>, IEquatable<SkinInfo>, IHasPrimaryKey, ISoftDelete
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public string Name { get; set; }