-
Notifications
You must be signed in to change notification settings - Fork 0
/
IIdentifiable.cs
63 lines (58 loc) · 1.64 KB
/
IIdentifiable.cs
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
/*
* IIdentifiable.cs
*
* Created: 2023-03-13-05:50:24
* Modified: 2023-03-29-12:12:20
*
* Author: David G. Moore, Jr. <[email protected]>
*
* Copyright © 2022 - 2023 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
*/
namespace Dgmjr.Abstractions;
/// <summary>
/// Marker interface for an object or struct that has a *read-only*
/// <c><see cref="Id">Id</see></c> property.
/// </summary>
public interface IIdentifiable
{
/// <summary>
/// The object's unique identifier.
/// </summary>
object Id { get; }
}
/// <summary>
/// Marker interface for an object or struct that has a *read-only*
/// <c><see cref="Id">Id</see></c> property of type <typeparamref name="TId"/>.
/// </summary>
public interface IIdentifiable<TId>
// where TId : IComparable, IEquatable<TId>
{
/// <summary>
/// The object's unique identifier.
/// </summary>
TId Id { get; }
}
/// <summary>
/// Marker interface for an object or struct that has a *read/write*
/// <c><see cref="Id">Id</see></c> property.
/// </summary>
public interface IHaveAWritableId : IIdentifiable
{
/// <summary>
/// The object's unique identifier.
/// </summary>
new object Id { get; set; }
}
/// <summary>
/// Marker interface for an object or struct that has a *read/write*
/// <c><see cref="Id">Id</see></c> property.
/// </summary>
public interface IHaveAWritableId<TId> : IIdentifiable<TId>
// where TId : IComparable, IEquatable<TId>
{
/// <summary>
/// The object's unique identifier.
/// </summary>
new TId Id { get; set; }
}