星空网 > 软件开发 > ASP.net

MVC初学

问题:

entitytype has no key defined

 

Solution:

  1. 增加引用
  2. 增加关键字[Key]
 using System.ComponentModel.DataAnnotations;[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContactsID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]    [Key]    public int ContactsID    {      get      {        return this._ContactsID;      }      set      {        if ((this._ContactsID != value))        {          this.OnContactsIDChanging(value);          this.SendPropertyChanging();          this._ContactsID = value;          this.SendPropertyChanged("ContactsID");          this.OnContactsIDChanged();        }      }    }

 




原标题:MVC初学

关键词:mvc

mvc
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流