私のプロジェクトにはKeyクラスがあります。ここでDBにエントリを追加できません(ASP.NET MVC)
はコード
public partial class Key
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Key()
{
this.Appointments = new HashSet<Appointment>();
}
public int Id { get; set; }
public string Key1 { get; set; }
public string English { get; set; }
public string German { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Appointment> Appointments { get; set; }
}
であると私は、エントリを追加するために必要なもの、クラスはこのテーブルに関連しているのキーテーブルを持っています。ここで
は
public ActionResult AddNewKey(string german, string english, string keyVal,
string typeOfInvestigation)
{
using (var ctx = new ApplicationDbContext())
{
Key key = new Key()
{
German = german,
English = english,
Key1 = keyVal,
//Type_of_investigation_principle = typeOfInvestigation
};
ctx.Keys.Add(key);
ctx.SaveChanges();
return Json(new {Result = "Success", Message = "Saved Successfully"});
}
}
を追加するためのバックエンドのコードである。しかしAdd(key)
に、私はエラーを持っています。
シンボルはなぜ
を追加解決できませんか?
クリーンで再構築が役に立たない
この問題をどのように解決できますか。 Visual Studioの→メニュー→ツール→オプション→ReSharperの、(再び閉鎖する必要がボタンと再開を中断しないように
ゴー:
したがって、どのタイプが 'ApplicationDbContext.Keys'ですか? – CodeCaster
エラーは、Resharper @ CodeCaster –