jellyfin/Jellyfin.Data/Entities/ProviderMapping.cs

128 lines
3.9 KiB
C#
Raw Normal View History

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities
{
2020-05-02 21:56:05 +00:00
public partial class ProviderMapping
{
partial void Init();
/// <summary>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </summary>
protected ProviderMapping()
{
Init();
}
/// <summary>
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
/// </summary>
public static ProviderMapping CreateProviderMappingUnsafe()
{
return new ProviderMapping();
}
/// <summary>
/// Public constructor with required data.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <param name="providername"></param>
/// <param name="providersecrets"></param>
/// <param name="providerdata"></param>
/// <param name="_user0"></param>
/// <param name="_group1"></param>
public ProviderMapping(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
{
2020-06-20 08:35:29 +00:00
if (string.IsNullOrEmpty(providername))
{
throw new ArgumentNullException(nameof(providername));
}
2020-05-02 21:56:05 +00:00
this.ProviderName = providername;
2020-06-20 08:35:29 +00:00
if (string.IsNullOrEmpty(providersecrets))
{
throw new ArgumentNullException(nameof(providersecrets));
}
2020-05-02 21:56:05 +00:00
this.ProviderSecrets = providersecrets;
2020-06-20 08:35:29 +00:00
if (string.IsNullOrEmpty(providerdata))
{
throw new ArgumentNullException(nameof(providerdata));
}
2020-05-02 21:56:05 +00:00
2020-06-20 08:35:29 +00:00
this.ProviderData = providerdata;
2020-05-02 21:56:05 +00:00
Init();
}
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>
/// <param name="providername"></param>
/// <param name="providersecrets"></param>
/// <param name="providerdata"></param>
/// <param name="_user0"></param>
/// <param name="_group1"></param>
public static ProviderMapping Create(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
{
return new ProviderMapping(providername, providersecrets, providerdata, _user0, _group1);
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Identity, Indexed, Required.
2020-05-02 21:56:05 +00:00
/// </summary>
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
/// <summary>
/// Required, Max length = 255
/// </summary>
[Required]
[MaxLength(255)]
[StringLength(255)]
public string ProviderName { get; set; }
/// <summary>
/// Required, Max length = 65535
/// </summary>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
public string ProviderSecrets { get; set; }
/// <summary>
/// Required, Max length = 65535
/// </summary>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
public string ProviderData { get; set; }
/// <summary>
/// Required, ConcurrenyToken.
2020-05-02 21:56:05 +00:00
/// </summary>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
public void OnSavingChanges()
{
RowVersion++;
}
/*************************************************************************
* Navigation properties
*************************************************************************/
}
}