0

私はモデルを持っています:

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ファイルの名前を;に変更するまで、これは完全に機能します。その後、バインディングは失敗します。DogCatRatGoatおよびに同じ DisplayTemplate を使用したいのですがGnu、これらはすべて の実装ですIPet

バインディングを機能させるにはどうすればよいですか?

4

1 に答える 1