Merge pull request #980 from dotnet-architecture/fix/replacement-for-pr-704
Simplify Enumeration and CardType classes as proposed in PR #704
This commit is contained in:
commit
8960db40d4
@ -9,31 +9,13 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
|||||||
public class CardType
|
public class CardType
|
||||||
: Enumeration
|
: Enumeration
|
||||||
{
|
{
|
||||||
public static CardType Amex = new AmexCardType();
|
public static CardType Amex = new CardType(1, "Amex");
|
||||||
public static CardType Visa = new VisaCardType();
|
public static CardType Visa = new CardType(2, "Visa");
|
||||||
public static CardType MasterCard = new MasterCardType();
|
public static CardType MasterCard = new CardType(3, "MasterCard");
|
||||||
|
|
||||||
public CardType(int id, string name)
|
public CardType(int id, string name)
|
||||||
: base(id, name)
|
: base(id, name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AmexCardType : CardType
|
|
||||||
{
|
|
||||||
public AmexCardType() : base(1, "Amex")
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
|
|
||||||
private class VisaCardType : CardType
|
|
||||||
{
|
|
||||||
public VisaCardType() : base(2, "Visa")
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MasterCardType : CardType
|
|
||||||
{
|
|
||||||
public MasterCardType() : base(3, "MasterCard")
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,6 @@
|
|||||||
public static OrderStatus Shipped = new OrderStatus(5, nameof(Shipped).ToLowerInvariant());
|
public static OrderStatus Shipped = new OrderStatus(5, nameof(Shipped).ToLowerInvariant());
|
||||||
public static OrderStatus Cancelled = new OrderStatus(6, nameof(Cancelled).ToLowerInvariant());
|
public static OrderStatus Cancelled = new OrderStatus(6, nameof(Cancelled).ToLowerInvariant());
|
||||||
|
|
||||||
protected OrderStatus()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderStatus(int id, string name)
|
public OrderStatus(int id, string name)
|
||||||
: base(id, name)
|
: base(id, name)
|
||||||
{
|
{
|
||||||
|
@ -11,9 +11,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork
|
|||||||
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
protected Enumeration()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
protected Enumeration(int id, string name)
|
protected Enumeration(int id, string name)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user