-
-
Notifications
You must be signed in to change notification settings - Fork 747
Expand file tree
/
Copy pathEntityNotFoundException.cs
More file actions
76 lines (63 loc) · 2.18 KB
/
Copy pathEntityNotFoundException.cs
File metadata and controls
76 lines (63 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Runtime.Serialization;
namespace BlazorHero.CleanArchitecture.Application.Exceptions
{
[Serializable]
public class EntityNotFoundException : Exception
{
/// <summary>
/// Type of the entity.
/// </summary>
public Type EntityType { get; set; }
/// <summary>
/// Id of the Entity.
/// </summary>
public object Id { get; set; }
/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException()
{
}
/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException(SerializationInfo serializationInfo, StreamingContext context)
: base(serializationInfo, context)
{
}
/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException(Type entityType, object id)
: this(entityType, id, null)
{
}
/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
public EntityNotFoundException(Type entityType, object id, Exception innerException)
: base($"There is no such an entity. Entity type: {entityType.FullName}, id: {id}", innerException)
{
EntityType = entityType;
Id = id;
}
/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
/// <param name="message">Exception message</param>
public EntityNotFoundException(string message)
: base(message)
{
}
/// <summary>
/// Creates a new <see cref="EntityNotFoundException"/> object.
/// </summary>
/// <param name="message">Exception message</param>
/// <param name="innerException">Inner exception</param>
public EntityNotFoundException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}