89 lines
3.3 KiB
C#
89 lines
3.3 KiB
C#
using System;
|
|
using System.Runtime.Serialization;
|
|
using Kreta.Framework.Localization;
|
|
using Kreta.Framework.Logging;
|
|
|
|
namespace Kreta.Framework.Entities
|
|
{
|
|
/// <summary>
|
|
/// Nem létező entitásra történt hivatkozás.
|
|
/// </summary>
|
|
[FriendlyName(1000024, "A hivatkozott entitás nem található.")]
|
|
[ErrorCode(Events.ENTITY_NOTFOUND)]
|
|
[Serializable]
|
|
public sealed class EntityNotFoundException : EntityException
|
|
{
|
|
const string _errorMessage = "The entity does not exist.";
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="entityName">Az entitás neve</param>
|
|
/// <param name="entityId">Az entitás adatbázisbeli azonosítója</param>
|
|
public EntityNotFoundException(string entityName, int entityId)
|
|
: base(_errorMessage)
|
|
{
|
|
SetValue("EntityName", entityName);
|
|
SetValue("EntityId", entityId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="entityName">Az entitás neve</param>
|
|
/// <param name="associationName">Az asszociáció neve</param>
|
|
/// <param name="partnerId">Az asszociációs partner azonosítója</param>
|
|
public EntityNotFoundException(string entityName, string associationName, int partnerId)
|
|
: base(_errorMessage)
|
|
{
|
|
SetValue("EntityName", entityName);
|
|
SetValue("AssociationName", associationName);
|
|
SetValue("PartnerId", partnerId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="entityName">Az entitás neve</param>
|
|
/// <param name="entityId">Az entitás adatbázisbeli azonosítója</param>
|
|
/// <param name="entitySerial">Az entitás verziószáma</param>
|
|
public EntityNotFoundException(string entityName, int entityId, int entitySerial)
|
|
: base(_errorMessage)
|
|
{
|
|
SetValue("EntityName", entityName);
|
|
SetValue("EntityId", entityId);
|
|
SetValue("EntitySerial", entitySerial);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály alapértelmezett konstruktora.
|
|
/// </summary>
|
|
[Obsolete("Ezt a konstruktort ne használd!")]
|
|
public EntityNotFoundException() { }
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="message">A kivétel üzenete</param>
|
|
[Obsolete("Ezt a konstruktort ne használd!")]
|
|
public EntityNotFoundException(string message)
|
|
: base(message) { }
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="message">A kivétel üzenete</param>
|
|
/// <param name="innerException">A belső kivétel</param>
|
|
[Obsolete("Ezt a konstruktort ne használd!")]
|
|
public EntityNotFoundException(string message, Exception innerException)
|
|
: base(message, innerException) { }
|
|
|
|
/// <summary>
|
|
/// Az osztály konstruktora.
|
|
/// </summary>
|
|
/// <param name="info">Sorosítási adatok</param>
|
|
/// <param name="context">Sorosítási adatfolyam</param>
|
|
EntityNotFoundException(SerializationInfo info, StreamingContext context)
|
|
: base(info, context) { }
|
|
}
|
|
}
|