The entity cannot be constructed in a LINQ to Entit
2017-12-28 11:18
316 查看
public IQueryable GetProducts(int categoryID)
{
var productList = db.Products
.Where(p => p.CategoryID == categoryID)
.ToList()
.Select(item =>
new Product
{
Name = item.Name
})
.AsQueryable(); // actually it's not useful after "ToList()" :D
return productList;
}
{
var productList = db.Products
.Where(p => p.CategoryID == categoryID)
.ToList()
.Select(item =>
new Product
{
Name = item.Name
})
.AsQueryable(); // actually it's not useful after "ToList()" :D
return productList;
}
相关文章推荐
- The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid
- Cannot update VMware Tools correctly :the configuration program is to be executed in a virtual match
- cannot be resolved to absolute file path because it does not reside in the file system
- cannot be resolved to absolute file path because it does not reside in the file system
- LINQ to Entities does not recognize the method , and this method cannot be translated into a store expression 解决办法
- The transaction log for database 'NJ_Address' is full. To find out why space in the log cannot be
- The transaction log for database 'wcadmin' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.datab
- The type String cannot be constructed. You must configure the container to supply this value.
- QTP的那些事--回放的时候出现了the selected object cannot be found in the aplication.check that the applicaton is open to the
- The type Database cannot be constructed. You must configure the container to supply this value.
- bpel 测试遇到“The content of the body cannot be displayed in the form view. Please switch to the source”
- maven构建 出错:cannot be resolved to absolute file path because it does not reside in the file system
- 关于.ToList(): LINQ to Entities does not recognize the method ‘xxx’ method, and this method cannot be translated into a store expression.
- ADO.NET Entity framework 连接MySql 提示The specified store provider cannot be found in the configuration
- cannot be resolved to absolute file path because it does not reside in the file system : jar:file:/D
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- 报错: LINQ to Entities does not recognize the method...and this method cannot be translated into a sto
- The import org.apache.commons cannot be resolved in eclipse juno
- HierarchyRequestError:Nodecannotbeinsertedatthespecifiedpointinthe
- a value of type "const struct Menu * "cannot be assigned to an entity of type "struct Menu"