I feel like I am missing something basic here.
I have 2 interfaces. One is called IIdentifiable which specifies the existence of an Id property. The second can really be anything that is also identifiable. See code below.
public interface IIdentifiable
{
Guid Id { get; set; }
}
public interface IPerson : IIdentifiable
{
string Name { get; set; }
}
The problem:
When using the Html.HiddenFor (or any other helper method) and the model is strongly typed to the IPerson interface, I get an error when accessing the properties of the IIdentifiable interface. I can access and display the data in the IIdentifiable properties by going directly against Model.Id but not when using the lambda expression and accessing the model that way.
The error I get is "The property *.IPerson.Id could not be found".
This only seems to be the case when using the Razor view engine. I know this was working using ASP.NET MVC 2 and the WebForms view engine. I haven't tried it on the ASP.NET MVC 3 using the WebForms view engine yet.