1- namespace Modular . Monolithic . Architecture . Helper . Domain . Abstractions ;
1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+
4+ namespace Modular . Monolithic . Architecture . Helper . Domain . Abstractions ;
25
36/// <summary>
47/// Represents the id value entities.
@@ -8,7 +11,7 @@ public abstract class TypedIdValueBase : IEquatable<TypedIdValueBase>
811 /// <summary>
912 /// Gets or sets the entity identifier.
1013 /// </summary>
11- public Guid Value { get ; private set ; }
14+ public Guid Id { get ; private set ; }
1215
1316 protected TypedIdValueBase ( Guid value )
1417 {
@@ -17,7 +20,7 @@ protected TypedIdValueBase(Guid value)
1720 throw new InvalidOperationException ( "Id value cannot be empty!" ) ;
1821 }
1922
20- Value = value ;
23+ Id = value ;
2124 }
2225
2326 /// <summary>
@@ -26,35 +29,17 @@ protected TypedIdValueBase(Guid value)
2629 /// <param name="left"></param>
2730 /// <param name="right"></param>
2831 /// <returns></returns>
29- public static bool operator == ( TypedIdValueBase left , TypedIdValueBase right )
30- {
31- if ( Object . Equals ( left , null ) )
32- {
33- return Object . Equals ( right , null ) ;
34- }
35- else
36- {
37- return left . Equals ( right ) ;
38- }
39- }
32+ public static bool operator == ( TypedIdValueBase left , TypedIdValueBase right ) => Object . Equals ( left , null ) ? Object . Equals ( right , null ) : left . Equals ( right ) ;
4033
4134 public static bool operator != ( TypedIdValueBase left , TypedIdValueBase right ) => ! ( left == right ) ;
4235
4336 /// <inheritdoc />
44- public bool IsTransient ( ) => Value == default ;
37+ public bool IsTransient ( ) => Id == default ;
4538
4639 /// <inheritdoc />
47- public override bool Equals ( object obj )
48- {
49- if ( obj is null )
50- {
51- return false ;
52- }
53-
54- return obj is TypedIdValueBase other && Equals ( other ) ;
55- }
40+ public override bool Equals ( object obj ) => obj is not null && obj is TypedIdValueBase other && Equals ( other ) ;
5641 // <inheritdoc />
57- public bool Equals ( TypedIdValueBase other ) => Value == other ? . Value ;
42+ public bool Equals ( TypedIdValueBase other ) => Id == other ? . Id ;
5843 /// <inheritdoc />
59- public override int GetHashCode ( ) => Value . GetHashCode ( ) ;
44+ public override int GetHashCode ( ) => Id . GetHashCode ( ) ;
6045}
0 commit comments