jellyfin/Jellyfin.Data/Entities/Libraries/Collection.cs
Patrick Barron acb213e4b8 First pass at cleaning entity classes.
- Documents all library entities
- Fixes styling warnings for library entities
- Updates library entities to inherit from interfaces
- Makes library entites no longer partial.
2020-08-30 18:51:31 -04:00

56 lines
1.5 KiB
C#

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
/// <summary>
/// An entity representing a collection.
/// </summary>
public class Collection : IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Collection"/> class.
/// </summary>
public Collection()
{
Items = new HashSet<CollectionItem>();
}
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <remarks>
/// Identity, Indexed, Required.
/// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <remarks>
/// Max length = 1024.
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
public string Name { get; set; }
/// <inheritdoc />
[ConcurrencyCheck]
public uint RowVersion { get; set; }
/// <summary>
/// Gets or sets a collection containing this collection's items.
/// </summary>
public virtual ICollection<CollectionItem> Items { get; protected set; }
/// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
}
}