无法推断方法EditorFor的类型参数

时间:2015-04-13 10:14:08

标签: c# razor asp.net-mvc-5

虽然页面运行正常,但在我的视图中出现了很多错误,并且在执行以下操作时没有预先输入错误:

@using( Html.BeginForm() )
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        @Html.EditorFor( x => x.Sausage.WibbleWobble)

My View将模型声明为视图模型,它具有2个属性:

@model Blah.WebUI.Models.ViewModels.SausageViewModels.SausageEditViewModel

-

public class SausageEditViewModel : BaseListViewModel
{
    public Sausage Sausage{ get; set; }
    public IEnumerable<System.Web.Mvc.SelectListItem> SausageTypes { get; set; }
}

我做错了什么?

这是我的香肠:

using Blah.Domain.Abstract;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Blah.Domain.Objects.Entities
{
    public class Sausage : ISoftDeletable, ITimeStamps, ICreatedBy
    {
        [Key]
        public int SausageID { get; set; }

        public WibbleWobble WibbleWobble {get;set;}
        ...

0 个答案:

没有答案