我正在爲支持足球隊從應用程序收集統計數據的應用程序創建web api。我現在正在執行階段。而且可以說,我在想什麼(如果需要的話)的設計模式的類型將是最好的東西是這樣的:哪種設計模式最適合足球比賽的應用程序
public class Shot
{
public int Id { get; set; }
public int PlayerId { get; set; }
public string Comment { get; set; }
public bool OnGoal { get; set; }
public int GameId { get; set; }
}
和
public class Card
{
public int Id { get; set; }
public int PlayerId { get; set; }
public string Comment { get; set; }
public bool IsRed{ get; set; }
public int GameId { get; set; }
}
正如你可以看到一些性質相同。它應該用接口,繼承(f.e. class Action)來實現,或者我應該使用設計模式之一(哪一個)?實體框架最好能避免後期的問題?
爲什麼卡沒有遊戲ID? –
只是錯過了它。我編輯問題 –