Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 基本接口属性未在MVC视图中绑定_C#_Asp.net Mvc - Fatal编程技术网

C# 基本接口属性未在MVC视图中绑定

C# 基本接口属性未在MVC视图中绑定,c#,asp.net-mvc,C#,Asp.net Mvc,我有一个接口I产品:IAuditable public interface IProduct : IAuditable { string Code { get; set; } string Name { get; set; } string Description { get; set; } ProductItemsList Items { get; } ProductType Type { get;

我有一个接口
I产品:IAuditable

public interface IProduct : IAuditable
    {
        string Code { get; set; }

        string Name { get; set; }

        string Description { get; set; }

        ProductItemsList Items { get; }

        ProductType Type { get; }
    }
其中,IAuditable的定义为:

public interface IAuditable
    {
        DateTimeOffset CreatedOn { get; }

        int CreatedBy { get; }

        DateTimeOffset ModifiedOn { get; }

        int ModifiedBy { get; }
    }
在绑定到IPProduct的可枚举项的视图中

这项工作: (顺便说一句,ReSharper告诉我移除演员阵容)

但这失败了:

@Html.DisplayFor(model => model.ModelObject.CreatedOn)
(错误为“找不到MyProj.Products.ipproduct.CreatedOn”)


有人能给我解释一下吗。今天是星期五下午,所以我可能有点傻。

你确定IProduct继承了IAuditable吗?你能给我们看一下它的定义吗?可能是@Selman22,我在上面添加了IPProduct接口。如果你的具体类实现了IAuditable,但显式实现了CreatedOn,这可能会发生。您能给出一个实现IPProduct的具体类的示例吗
@Html.DisplayFor(model => model.ModelObject.CreatedOn)