-2
我在SQL服務器中創建了一個視圖,然後將其添加到Visual Studio 2012中的我的edmx文件中。然後,我在Postman上進行了POST操作並得到了此運行時錯誤。我在我的應用程序中使用EF。我嘗試保存將新記錄插入患者視圖
Unable to update the EntitySet 'ViewPatient' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
//Controller action code namespace MvcWebAPI.Models
{
using System;
using System.Collections.Generic;
public partial class ViewPatient
{
public int PatientID { get; set; }
public int MedicationID { get; set; }
public int GPID { get; set; }
public string Firstname { get; set; }
public string Surname { get; set; }
public System.DateTime DOB { get; set; }
public string Medication { get; set; }
public string Alergies { get; set; }
public string MedicationHistory { get; set; }
}
}
你有問題要問? – snh 2015-03-03 11:50:45
顯然。我在SQL服務器中創建了一個視圖,然後添加到visual studio 2012中的edmx文件中,然後在Postman上進行POST操作並得到此運行時錯誤。我將如何去解決它。 – user3529620 2015-03-03 11:54:12
爲了將來的參考,你可能想在你的提交中提出你的問題。要回答您的評論,請嘗試閱讀提供給您的消息並根據它進行調試: '無法更新EntitySet'ViewPatient',因爲它具有定義查詢並且元素中不存在元素以支持當前操作。' –
snh
2015-03-03 11:56:27