名称空间.Net Core MVC中不存在类型或命名空间

时间:2017-07-28 09:14:30

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

我的.Net Core MVC项目中出现了一个奇怪的错误。它告诉我:类型或命名空间名称'Tripmetadata'在名称空间'MSPFrontend.Models'中不存在(你是否缺少程序集引用?)

enter image description here

enter image description here

enter image description here

我有很多观点正在使用此文件夹中的模型而没有任何问题。在我的_ViewImports.cshtml我有:

@using MSPFrontend.Models

Tripmetadata.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace MSPFrontend.Models
{
    public partial class Tripmetadata
    {
        public Tripmetadata()
        {
            Tripgpsdata = new HashSet<Tripgpsdata>();
            Tripstate = new HashSet<Tripstate>();
        }

        [Key]
        public int Tripid { get; set; }

        [Display(Name = "Start Timestamp")]
        public long? Starttimestamp { get; set; }

        [Display(Name = "End Timestamp")]
        public long? Endtimestamp { get; set; }

        public long? Duration { get; set; }

        [Display(Name = "Average Speed")]
        public decimal? AvgSpeed { get; set; }

        public decimal? Distance { get; set; }

        public virtual ICollection<Tripgpsdata> Tripgpsdata { get; set; }
        public virtual ICollection<Tripstate> Tripstate { get; set; }
    }
}

0 个答案:

没有答案