2015年12月28日 星期一

【ASP.NET MVC】The parameters dictionary contains a null entry for parameter 'XXX' of non-nullable type 'System.Type' for method 'System.Web.Mvc.ActionResult GetYYY(System.Type)' in 'Namespace.XXXController'.

對 'Namespace.XXXController' 的方法 'System.Web.Mvc.ActionResult GetXXX(System.Type)' 中不可為 null 型別 'System.Type' 的參數 'YYY' 而言,參數字典含有 null 項目。選擇性參數必須是參考型別、可為 null 的型別,或必須宣告為選擇性參數。

2015年12月21日 星期一

【Entity Framework】Update model from database

由資料庫更新模型後產生大量錯誤

'Namespace.XXXClassName' 和 'Namespace.XXXClassName' 因為名稱相同導致模稜兩可; 請修改名稱或進一步限定名稱

'Namespace.XXXEntities' 不包含 'XXXStoredProcedure' 的定義,也找不到擴充方法 'XXXStoredProcedure' 來接受型別 'Namespace.XXXEntities' 的第一個引數 (您是否遺漏 using 指示詞或組件參考?)

還有其他有的沒的錯誤

【ASP.NET MVC】There is no ViewData item of type 'IEnumerable' that has the key 'xxx'

沒有型別為 'IEnumerable' 且具有索引鍵 'xxx' 的 ViewData 項目。

【ASP.NET MVC】The ViewData item that has the key 'xxx' is of type 'System.String' but must be of type 'IEnumerable'

具有索引鍵 'xxx' 的 ViewData 項目為 'System.String' 型別,但必須是 'IEnumerable' 型別。

2015年12月20日 星期日

【Entity Framework】The ObjectContext might be in an inconsistent state

對資料庫的變更認可成功,但是在更新物件內容時發生錯誤。ObjectContext 可能處於不一致的狀態。
The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. and so on.

2015年12月8日 星期二

【SQL】Using WHERE IN Clause in Stored Procedure

在預存程序使用 WHERE col IN ('xxx', 'yyy', ...) 這樣的條件式,且 'xxx', 'yyy', ... 的部分以參數型式傳入的方法。

【Entity Framework】Stored procedure returns int instead of result set

Entity Framework 匯進來的 Stored procedure 沒回傳 Select 結果,而是給你 procedure  執行結果 int 值的問題。