var query = DataEntities.CLD_CLASSDEF.Where(p => p.ID == new Guid(form["ID"])).FirstOrDefault();
會造成 Only parameterless constructors and initializers are supported in LINQ to Entities
解法為
var query = (from p in dataContext.CLD_CLASSDEF
where p.ID.CompareTo(cldDetailID) == 0
select p).FirstOrDefault();
原因 ??
我也不知道
下面這兩篇好像有討論到,有時間再看
http://mosesofegypt.net/post/2008/08/24/LINQ-to-Entities-what-is-not-supported.aspx
http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/9dee0d13-490c-48aa-bad5-50768d3cedf1/
沒有留言:
張貼留言