http://weblogs.asp.net/pwelter34/entity-framework-batch-update-and-future-queries…
扩展了实体框架的功能类库. https://github.com/loresoft/EntityFramework.Extended 1批量更新/删除 1)删除 //delete all users where FirstName matches context.Users.Delete(u => u.FirstName == "firstname"); 2)更新 //update all tasks with status of 1 to status of 2 context…
E文好的可以直接看https://github.com/loresoft/EntityFramework.Extended 也可以在nuget上直接安装这个包,它的说明有点过时了,最新版本已经改用对IQueryable<T>的扩展,而不是DbSet<T>(已经标记为弃用),所以跟我一样有隔离癖好的就可以大胆使用了.下面介绍如何批量删除.更新.查询. 批量删除 //EF原生的删除需要先取出entity然后remove context.Remove(context.Users.Firs…
转自:http://www.cnblogs.com/jinzhao/archive/2013/05/31/3108755.html 今天乍一看,园子里居然没有关于这个类库的文章,实在是意外毕竟已经有很多介绍EF使用的文章了. E文好的可以直接看https://github.com/loresoft/EntityFramework.Extended 也可以在nuget上直接安装这个包,它的说明有点过时了,最新版本已经改用对IQueryable<T>的扩展,而不是DbSet<T>(已经…
E文好的可以直接看https://github.com/loresoft/EntityFramework.Extended 也可以在nuget上直接安装这个包 1.先更新VS的NuGet版本http://docs.nuget.org/docs/start-here/installing-nuget 2.修改默认地址: Options => Package Manager => Generalhttp://go.microsoft.com/fwlink/?LinkID=206669 3.安装包…
本文转自:https://weblog.west-wind.com/posts/2013/Dec/22/Entity-Framework-and-slow-bulk-INSERTs I’ve been working on an internal project where I needed to load up a large amount of records into a database for testing. On this project I’m using Entity Fram…
public static class DbContextExtensions { public static void DeleteBatch<T>(this DbContext context, IQueryable<T> query) where T : class { string sqlClause = GetClause<T>(query); context.Database.ExecuteSqlCommand(String.Format("DEL…
在博客园很久了,一直只看不说,这是发布本人的第一个博客. 总结一下在项目中,EntityFramework使用的一下经验拿来和大家分享,希望对大家有用~ 1.         在Entity Framework中使用事务 1) TransactionScope using (BlogDbContext context =new BlogDbContext()) { using (TransactionScope transaction =new TransactionScope()) { con…
这个Entity Framework扩展完全支持EF 5.0/6.0,项目地址 https://github.com/loresoft/EntityFramework.Extended,这个库支持批量更新,删除.查询结果缓存和审计日志.这个扩展对于每次批量操纵只生成一条sql语句,而不会像EntityFramework供给的原生办法那样批量N条数据就要生成N条sql语句. 园子里也有了一个详细的介绍<Entity Framework Extended Library (EF扩展类库,支持批量更新…
entity framework6.x之前搞了这么多版本,构架这么牛B,居然没有批量插入更新的功能,但有很多替换的解决方案,例如Entity Framework Extended Library(https://github.com/loresoft/EntityFramework.Extended).手工拼接sql语句. 现在微软正在推出core版的ef,它号称比6.x更加轻量级和高效,今天试一下了一下它的批量插入,感觉不错 C#源码: public class BloggingContext…
Chapter6 Controlling Database Location,Creation Process, and Seed Data 第6章 控制数据库位置,创建过程和种子数据 In previous chapters you have seen how convention and configuration can be used to affect the model and the resulting database schema. In this chapter you wi…
在EF实体框架中进行日志跟踪,一般都是自己写个Log实体类,在数据保存时进行属性原始值验证来进行日志跟踪.当然还可以使用一些第三扩展库例如:entity framework extended进行日志记录,本文介绍如何使用TrackerEnabledDbContext进行操作日志跟踪. 1,首先创建项目工程,TrackerEnabledDbContext只支持4.5及以上框架,详情见:https://www.nuget.org/packages/TrackerEnabledDbContext 2,…
Creating Entities First of all, Let's create some entities to have a test. Create a project Add following packages by NuGet EntityFramework MySql.Data.Entity (I'm just using MySql, it's not necessary) Add some codes: class Class { public int ClassId…
前言 Entity Framework 延伸系列目录 今天我们来讲讲EntityFramework.Extended 首先科普一下这个EntityFramework.Extended是什么,如下: 这是一个对Entity Framework进行扩展的类库. 完全支持EF 5.0/6.0+, GitHub地址 https://github.com/loresoft/EntityFramework.Extended, 最后一次更新是在2015/07/10 这个库支持批量更新,删除.查询结果缓存和审计…
1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Model: Programming Against a Model,Not the Database 实体关系模型:使用模型编程,而非数据库 2 The Entity Data Model: A Client-Side Data Model 试题对象模型:客户端对象模型 3 Entities: Blu…
原文地址:https://docs.asp.net/en/latest/data/ef-mvc/intro.html The Contoso University sample web application demonstrates how to create ASP.NET Core 1.0 MVC web applications using Entity Framework Core 1.0 and Visual Studio 2015. Contoso University网络应用的案…
本文内容为转载,重新排版以供学习研究.如有侵权,请联系作者删除. 转载请注明本文出处:Professional C# 6 and .NET Core 1.0 - 38 Entity Framework Core ----------------------------------------------------------------------- What's In This Chapter? Introducing Entity Framework Core 1.0 Using Depe…
本文内容为转载,重新排版以供学习研究.如有侵权,请联系作者删除. 转载请注明本文出处:Professional C# 6 and .NET Core 1.0 - Chapter 38 Entity Framework Core ----------------------------------------------------------------------- What’s In This Chapter? Introducing Entity Framework Core 1.0 Us…
Entity Framework是.NET平台下的一种简单易用的ORM框架,它既便于Domain Model和持久层的OO设计,也提高了代码的可维护性.但在使用中发现,有几类业务场景是EF不太擅长的,比如批量写入大量同类数据,为此本人做了一些对比测试,以供大家参考. 现假设我们需要做一个用户批量导入的功能,需要从某处导入1k~1w个User到SQLServer数据库,本人听说过的常见做法有如下几种: 使用ADO.NET单条SqlCommand执行1w次(根据常识作为EF的替代其性能还不够格,所以…
第7章 高级概念 The Code First modeling functionality that you have seen so far should be enough to get you up and running with most applications. However, Code First also includes some more advanced functionality that you may require as your needs advance.…
AppBox 是基于 FineUI 的通用权限管理框架,包括用户管理.职称管理.部门管理.角色管理.角色权限管理等模块. Entity Framework新增数据 以新增用户为例,作为对比,先来看下使用Subsonic的代码: using (TransactionScope scope = new TransactionScope()) { XUser item = new XUser(); item.Name = tbxName.Text.Trim(); item.ChineseName =…
from:http://msdn.microsoft.com/en-us/library/ms229335.aspx 我们平时在VS.net里引用的那些类库就是从这里来的 The .NET Framework class library is a library of classes, interfaces, and value types that provides access to system functionality and is designed to be the foundat…
原文:[翻译] - <Entity Framework> - 直接执行数据库命令 纯属学习上的记录, 非专业翻译, 如有错误欢迎指正! 原文地址: http://msdn.microsoft.com/en-us/library/gg715124(v=vs.103) 使用 EF 4.1 或者更新版本, 你可以直接执行任何数据库命令. 在本节介绍的方法允许你对数据库执行原生的 SQL 命令. 通过 SQL 查询语句获取实体对象集 DbSet 类中的 SqlQuery 方法允许你执行一个返回实体对象…
  NuGet Package PM> Install-Package EntityFramework.Extended NuGet: http://nuget.org/List/Packages/EntityFramework.Extended Source: http://github.com/loresoft/EntityFramework.Extended Batch Update and Delete A current limitations of the Entity Framew…
Improve response times and handle more users with parallel processing Building a web application using non blocking calls to the data layer is a great way to increase the scalability of your system. Performing a task asynchronously frees up the worke…
UPDATE: the source code for DbContextScope is now available on GitHub: DbContextScope on GitHub. A bit of context This isn't the first post that has been written about managing the DbContext lifetime in Entity Framework-based applications. In fact, t…
In this post we will be discussing about change tracking feature of Entity Framework Code First. Change tracking allows Entity framework to keep track of all the changes in entities' data. It might involve adding new entities to entities collection o…
本文转自:http://izzydev.net/.net/oracle/entityframework/2017/02/01/Porting-to-Oracle-with-Entity-Framework.html We had to port our giant-_ish_, Entity Framework based application to work on Oracle RDBMS (11g, later 12c). We did it. And we learned a lot.…
This article is dedicated to discussing the latest releases of the NHibernate and Entity Framework. NHibernate is (was?) a number one ORM Framework for ages. Its feature list is growing and some things such as code-based mappings and automatic migrat…
本文转自:http://www.asp.net/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-4/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application Creating an Entity Framework Data Model for an ASP.NET MVC Application (1 of 10)   By    …