モデルに再帰的なプロパティを含めることは可能ですか? 目標は、各アクションで文字列を動的に構築することです。ここに私が取り組んでいるものがあります:
public class Action
{
public int ActionId { get; set; }
public int? ParentId { get; set; }
public string Name { get; set; }
public string ActionName {
{
get
{
// example result: 1Ai or 2Bi
return ....
}
}
}
List<Action> aList = new List<Action>() {
new Action { ActionId = 1, Name = "Step 1" },
new Action { ActionId = 2, Name = "Step 2" },
new Action { ActionId = 3, ParentId = 1, Name = "A" },
new Action { ActionId = 4, ParentId = 1, Name = "B" },
new Action { ActionId = 5, ParentId = 2, Name = "A" },
new Action { ActionId = 6, ParentId = 2, Name = "B" },
new Action { ActionId = 5, ParentId = 3, Name = "i" },
new Action { ActionId = 6, ParentId = 6, Name = "i" }
}