#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
///
/// An entity representing a release for a library item, eg. Director's cut vs. standard.
///
public class Release : IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
///
/// The name of this release.
/// The owner of this release.
public Release(string name, IHasReleases owner)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
Name = name;
owner?.Releases.Add(this);
MediaFiles = new HashSet();
Chapters = new HashSet();
}
///
/// Initializes a new instance of the class.
///
///
/// Default constructor. Protected due to required properties, but present because EF needs it.
///
protected Release()
{
}
///
/// Gets or sets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
///
/// Gets or sets the name.
///
///
/// Required, Max length = 1024.
///
[Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Name { get; set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; set; }
///
/// Gets or sets a collection containing the media files for this release.
///
public virtual ICollection MediaFiles { get; protected set; }
///
/// Gets or sets a collection containing the chapters for this release.
///
public virtual ICollection Chapters { get; protected set; }
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}