Files
mixtape/zero.Core/Entities/Refs/Ref.cs
T

37 lines
673 B
C#
Raw Normal View History

2020-11-24 12:02:03 +01:00
namespace zero.Core.Entities
2020-11-22 22:31:45 +01:00
{
2021-05-04 17:23:52 +02:00
public class Ref<T> : Ref where T : ZeroIdEntity
2020-11-24 12:02:03 +01:00
{
public Ref() : base() { }
public Ref(string id) : base(id) { }
public static implicit operator Ref<T>(string id) => new Ref<T>(id);
public static implicit operator string(Ref<T> reference) => reference.Id;
}
2020-11-22 22:31:45 +01:00
public class Ref
{
public Ref() { }
2020-11-24 12:02:03 +01:00
public Ref(string id)
2020-11-22 22:31:45 +01:00
{
Id = id;
}
2020-11-24 12:02:03 +01:00
public string Id { get; set; }
2020-11-22 22:31:45 +01:00
public override string ToString()
{
2020-11-24 12:02:03 +01:00
return Id;
2020-11-22 22:31:45 +01:00
}
2020-11-24 12:02:03 +01:00
public static implicit operator Ref(string id) => new Ref(id);
public static implicit operator string(Ref reference) => reference.Id;
2020-11-22 22:31:45 +01:00
}
}