Refactor
This commit is contained in:
@@ -3,18 +3,12 @@ namespace ColaFlow.Shared.Kernel.Common;
|
||||
/// <summary>
|
||||
/// Base class for all entities
|
||||
/// </summary>
|
||||
public abstract class Entity
|
||||
public abstract class Entity(Guid id)
|
||||
{
|
||||
public Guid Id { get; protected set; }
|
||||
public Guid Id { get; protected set; } = id;
|
||||
|
||||
protected Entity()
|
||||
protected Entity() : this(Guid.NewGuid())
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
}
|
||||
|
||||
protected Entity(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
|
||||
@@ -5,16 +5,10 @@ namespace ColaFlow.Shared.Kernel.Common;
|
||||
/// <summary>
|
||||
/// Base class for creating type-safe enumerations
|
||||
/// </summary>
|
||||
public abstract class Enumeration : IComparable
|
||||
public abstract class Enumeration(int id, string name) : IComparable
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
protected Enumeration(int id, string name)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
}
|
||||
public int Id { get; private set; } = id;
|
||||
public string Name { get; private set; } = name;
|
||||
|
||||
public override string ToString() => Name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user