EntityFramework擴展之第三方類庫


EntityFramework 非常好用,結構優美.. 但是美中有不足:1.對動態查詢條件支持的不是很好 ;2.批量操作支持的不是很好.。
下面就是幾個第三方庫,對EntityFramework 的擴展

一、第三方類庫

LinqKit

動態拼裝查詢條件 

開源地址:https://github.com/scottksmith95/LINQKit

 

Entity Framework Extensions

(收費)Website: http://entityframework-extensions.net/

Paid library to dramatically improve Entity Framework performance:

  • BulkSaveChanges
  • BulkInsert
  • BulkUpdate
  • BulkDelete
  • BulkMerge
  • BulkSynchronize

Entity Framework Plus

開源免費:https://github.com/zzzprojects/EntityFramework-Plus

Website: http://entityframework-plus.net/

Free & Open source library that support following features:

  • Audit
  • Batch Operations
    • Batch Delete
    • Batch Update
  • Query
    • Query Cache
    • Query Deferred
    • Query Filter
    • Query Future
    • Query IncludeFilter
    • Query IncludeOptimized

 

EFUtilities

1.功能包含單屬性更新. 
2.Delete by query 
3.Batch insert entities 
4.Batch update entities 
5.Partial updates / Not loading the data from DB first 
6.Update by query 

如何使用看項目官網 
https://github.com/MikaelEliasson/EntityFramework.Utilities

代碼獲取方式如下:

支持EF4和5 
https://www.nuget.org/packages/EFUtilities/0.1.0

PM> Install-Package EFUtilities -Version 0.1.0 

 

支持EF6 
https://www.nuget.org/packages/EFUtilities

PM> Install-Package EFUtilities 

 

EntityFramework.Extended 

主要功能:批量更新和刪除,緩存 

//    Deleting

//delete all users where FirstName matches
context.Users
    .Where(u => u.FirstName == "firstname")
    .Delete();

//    Update

//update all tasks with status of 1 to status of 2
context.Tasks
    .Where(t => t.StatusId == 1)
    .Update(t => new Task { StatusId = 2 });

//example of using an IQueryable as the filter for the update
var users = context.Users.Where(u => u.FirstName == "firstname");
context.Users.Update(users, u => new User {FirstName = "newfirstname"});

 

2015年后停止更新。遷移到Entity Framework Plus

開源地址: https://github.com/loresoft/EntityFramework.Extended 

PM> Install-Package EntityFramework.Extended

 

 

efbulkinsert

批量插入 ,已遷移到Entity Framework Extensions
http://efbulkinsert.codeplex.com/

 

EF4
PM> Install-Package EntityFramework.BulkInsert-ef4 https://www.nuget.org/packages/EntityFramework.BulkInsert-ef4  EF5 PM> Install-Package EntityFramework.BulkInsert-ef5 https://www.nuget.org/packages/EntityFramework.BulkInsert-ef5  EF6 PM> Install-Package EntityFramework.BulkInsert-ef6 https://www.nuget.org/packages/EntityFramework.BulkInsert-ef6 

 

 

 

 

內容來自 :

https://blog.csdn.net/phker/article/details/49334287

 

 

EF學習推薦文章:你必須知道的EF知識和經驗

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM