zoukankan      html  css  js  c++  java
  • 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知识和经验

  • 相关阅读:
    springmvc与ajax交互
    [PAT] A1052 Linked List Sorting
    [PAT] A1032 Sharing
    [PAT] A1076 Forwards on Weibo
    [PAT] A1034 Head of a Gang
    [PAT] A1030 Travel Plan
    [PAT] A1031 Hello World for U
    [PAT] A1029 Median
    [PAT] A1028 List Sorting
    [PAT] A1026 Table Tennis
  • 原文地址:https://www.cnblogs.com/xcsn/p/8856716.html
Copyright © 2011-2022 走看看