using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities
{
public partial class Group
{
partial void Init();
///
/// Default constructor. Protected due to required properties, but present because EF needs it.
///
protected Group()
{
GroupPermissions = new HashSet();
ProviderMappings = new HashSet();
Preferences = new HashSet();
Init();
}
///
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
///
public static Group CreateGroupUnsafe()
{
return new Group();
}
///
/// Public constructor with required data
///
///
///
public Group(string name, User _user0)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
this.Name = name;
if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
_user0.Groups.Add(this);
this.GroupPermissions = new HashSet();
this.ProviderMappings = new HashSet();
this.Preferences = new HashSet();
Init();
}
///
/// Static create function (for use in LINQ queries, etc.)
///
///
///
public static Group Create(string name, User _user0)
{
return new Group(name, _user0);
}
/*************************************************************************
* Properties
*************************************************************************/
///
/// Identity, Indexed, Required
///
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
///
/// Required, Max length = 255
///
[Required]
[MaxLength(255)]
[StringLength(255)]
public string Name { get; set; }
///
/// Required, ConcurrenyToken
///
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
public void OnSavingChanges()
{
RowVersion++;
}
/*************************************************************************
* Navigation properties
*************************************************************************/
[ForeignKey("Permission_GroupPermissions_Id")]
public virtual ICollection GroupPermissions { get; protected set; }
[ForeignKey("ProviderMapping_ProviderMappings_Id")]
public virtual ICollection ProviderMappings { get; protected set; }
[ForeignKey("Preference_Preferences_Id")]
public virtual ICollection Preferences { get; protected set; }
}
}