摘要
Entity Framework一般通过LINQ代码或lambda表达式自动生成SQL语句,开发效率很高,然而使用时如果不注意会引来性能问题。通过对不同方法使用Entity Framework进行比较,提出Entity Framework数据访问性能优化的几种方法,包括更新数据时使用无跟踪查询、通过附加数据修改和删除数据、合理使用ToList()和FirstOrDefault()、合理使用预先加载。经过性能测试,这些方法是有效的。
Entity Framework by the LINQ code or lambda expression to automatically generate SQL statements,the development efficiency is very high,but if not pay attention when used will lead to performance problems.Through the comparison of different methods using Entity Framework,and several methods are put forward to optimize Entity Framework data access performance,including the updating of data without the use of additional data tracking,by Attachment data to modify and delete data,reasonable use ToList() and FirstOrDefault(),the rational use of pre loading.Through the performance test,the method is effective.
出处
《电脑开发与应用》
2014年第7期71-73,共3页
Computer Development & Applications