微软象关系对应(O/R Mapping)

Entity Framework的全称是ADO.NET Entity Framework,是微软开发的基于ADO.NET的ORM(Object/Relational Mapping)框架。

Entity Framework的主要特点:

1. 支持多种数据库(Microsoft SQL Server, Oracle, and DB2);

2. 强劲的映射引擎,能很好地支持存储过程;

3. 提供Visual Studio集成工具,进行可视化操作;

4. 能够与ASP.NET, WPF, WCF, WCF Data Services进行很好的集成。

已有打开的与此命令相关联的 DataReader,必须首先将它关闭

2017年07月28日

System.InvalidOperationException: 已有打开的与此命令相关联的 DataReader,必须首先将它关闭。 在 System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) 在 System.Data.SqlClient.SqlConnec...

The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.

2017年07月28日

今天在写代码的时候报如下错误:The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.截图如下:应该是Linq表达式不支持采用数组索引查询实体。看一下代码: using(UnitOfWork uow=new UnitOfWork()) { ...

The entity type Blog is not part of the model for the current context.

2017年07月28日

今天在写代码的时候报如下错误:The entity type Blog is not part of the model for the current context.截图如下:代码如下:using System.Data.Entity; using AppDAL.Entity; namespace AppDAL.Model { public class AppContext...

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'.

2017年07月27日

今天在写代码的时候,报了如下错误:其他信息: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of...

在 LINQ to Entities 查询中无法构造实体或复杂类型"xxxx"

2017年07月22日

今天在写代码的时候出现了一个 错误,提示如下:在 LINQ to Entities 查询中无法构造实体或复杂类型"xxxx"截图:错误代码如下:[ChildActionOnly]public PartialViewResult _TopicIndex(){ using (UnitOfWork uow = new UnitOfWork()) { var Topics = u...

entity framework not null

2017年07月15日

public int Id { get; set; } [DisplayName("主题名称")] [MaxLength(250)] public string TopicName { get; set; } public ICollection<TopicList> TopicList { get; ...

'OFFSET' 附近有语法错误。 在 FETCH 语句中选项 NEXT 的用法无效。

2017年06月04日

最近在使用asp.net core的时候,采用take().skip()分页的时候报如下错误:SqlException: 'OFFSET' 附近有语法错误。 在 FETCH 语句中选项 NEXT 的用法无效。这个主要是在sql server 2008中,不支持FETCH和NEXT语句(sql server 2012才支持)。之后在网上参考了一下其他的文章,最终解决了这个问题,记录一下,方便后来人。...

'OFFSET' 附近有语法错误

2017年06月04日

在切换到sqlserver 2008r2数据库版本后出现 {"'OFFSET' 附近有语法错误。\r\n在 FETCH 语句中选项 NEXT 的用法无效。"} 的报错。在了解sqlserver 2008r2并不支持fetch这种语法后大概就猜到ef生成了错误版本的sql脚本。项目中使用的是基于edmx文件的dbfirst方式,右键edmx文件选择“打开方式”菜单。使用xml编辑器打开edmx文件,...