MVCの学習を始めたばかりです。だから、ここに私のモデルクラスがあります
public class Patient : iPatient, iPerson
{
public string name { get; set; }
public int age { get; set; }
public DateTime dateOfBirth { get; set; }
public Address address { get; set; }
public string bloodGroup { get; set; }
}
したがって、コントローラーのアクション メソッドを右クリックしてビューを追加すると、スキャフォールディングによって次のようなビューが生成されます。
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.name)
</th>
<th>
@Html.DisplayNameFor(model => model.age)
</th>
<th>
@Html.DisplayNameFor(model => model.dateOfBirth)
</th>
<th>
@Html.DisplayNameFor(model => model.bloodGroup)
</th>
<th></th>
</tr>
のようなものは生成されません@Html.DisplayNameFor(model=>model.Address.City)
。
この動作はなぜですか?
ビューにこれを手動で追加する必要がありますか、それとも回避策はありますか?
ご回答ありがとうございます。