jellyfin/Jellyfin.Data/Entities/Libraries/Track.cs

55 lines
1.5 KiB
C#
Raw Normal View History

2020-09-01 08:36:45 -07:00
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using Jellyfin.Data.Interfaces;
2020-08-29 10:30:09 -07:00
namespace Jellyfin.Data.Entities.Libraries
{
/// <summary>
/// An entity representing a track.
/// </summary>
public class Track : LibraryItem, IHasReleases
2020-05-02 14:56:05 -07:00
{
/// <summary>
/// Initializes a new instance of the <see cref="Track"/> class.
2020-05-02 14:56:05 -07:00
/// </summary>
/// <param name="album">The album.</param>
public Track(MusicAlbum album)
2020-05-02 14:56:05 -07:00
{
if (album == null)
2020-06-20 01:35:29 -07:00
{
throw new ArgumentNullException(nameof(album));
2020-06-20 01:35:29 -07:00
}
album.Tracks.Add(this);
2020-05-02 14:56:05 -07:00
Releases = new HashSet<Release>();
TrackMetadata = new HashSet<TrackMetadata>();
2020-05-02 14:56:05 -07:00
}
/// <summary>
/// Initializes a new instance of the <see cref="Track"/> class.
2020-05-02 14:56:05 -07:00
/// </summary>
/// <remarks>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </remarks>
protected Track()
2020-05-02 14:56:05 -07:00
{
}
/// <summary>
/// Gets or sets the track number.
2020-05-02 14:56:05 -07:00
/// </summary>
public int? TrackNumber { get; set; }
2020-05-02 14:56:05 -07:00
/// <inheritdoc />
2020-05-02 14:56:05 -07:00
public virtual ICollection<Release> Releases { get; protected set; }
/// <summary>
/// Gets or sets a collection containing the track metadata.
/// </summary>
2020-05-02 14:56:05 -07:00
public virtual ICollection<TrackMetadata> TrackMetadata { get; protected set; }
}
}