私はモデルを持っています:
public class Dog: IPet
{
// IPet Implementation
public string Name { get; set; }
}
およびDisplayTemplateDisplayTemplates/Dog.cshtml
@model IPet // note this is the interface, not the concrete Dog
<label>@Model.Name</label>
IPet.cshtml
ファイルの名前を;に変更するまで、これは完全に機能します。その後、バインディングは失敗します。Dog
、Cat
、Rat
、Goat
およびに同じ DisplayTemplate を使用したいのですがGnu
、これらはすべて の実装ですIPet
。
バインディングを機能させるにはどうすればよいですか?