Quantcast
Channel: Fastest Way of Inserting in Entity Framework - Stack Overflow
Browsing all 33 articles
Browse latest View live

Answer by Leandro Bardelli for Fastest Way of Inserting in Entity Framework

Taking several notes, this is my implementation with improvements mine and from other answers and comments.Improvements:Getting the SQL connection string from my EntityUsing SQLBulk just in some parts,...

View Article



Answer by SelcukBah for Fastest Way of Inserting in Entity Framework

Configuration.LazyLoadingEnabled = false;Configuration.ProxyCreationEnabled = false;these are too effect to speed without AutoDetectChangesEnabled = false; and i advise to use different table header...

View Article

Answer by Michal Hosala for Fastest Way of Inserting in Entity Framework

Yes, SqlBulkUpdate is indeed the fastest tool for this type of task. I wanted to find "least effort" generic way for me in .NET Core so I ended up using great library from Marc Gravell called...

View Article

Answer by Ciro Corvino for Fastest Way of Inserting in Entity Framework

TL;DRI know it is an old post, but I have implemented a solution starting from one of those proposed by extending it and solving some problems of this; moreover I have also read the other solutions...

View Article

Answer by XavierAM for Fastest Way of Inserting in Entity Framework

[2019 Update] EF Core 3.1Following what have been said above, disabling AutoDetectChangesEnabled in EF Core worked perfectly: the insertion time was divided by 100 (from many minutes to a few seconds,...

View Article


Answer by Mallory H for Fastest Way of Inserting in Entity Framework

Use this technique to increase the speed of inserting records in Entity Framework. Here I use a simple stored procedure to insert the records. And to execute this stored procedure I use .FromSql()...

View Article

Answer by Manfred Wippel for Fastest Way of Inserting in Entity Framework

as it was never mentioned here I want to recomment EFCore.BulkExtensions herecontext.BulkInsert(entitiesList); context.BulkInsertAsync(entitiesList);context.BulkUpdate(entitiesList);...

View Article

Answer by Philip Johnson for Fastest Way of Inserting in Entity Framework

SqlBulkCopy is super quickThis is my implementation:// at some point in my calling code, I will call:var myDataTable =...

View Article


Answer by Reza Jenabi for Fastest Way of Inserting in Entity Framework

One of the fastest ways to save a listyou must apply the following codecontext.Configuration.AutoDetectChangesEnabled = false;context.Configuration.ValidateOnSaveEnabled =...

View Article


Answer by Guilherme for Fastest Way of Inserting in Entity Framework

I know this is a very old question, but one guy here said that developed an extension method to use bulk insert with EF, and when I checked, I discovered that the library costs $599 today (for one...

View Article

Image may be NSFW.
Clik here to view.

Answer by Marinpietri for Fastest Way of Inserting in Entity Framework

But, for more than (+4000) inserts i recommend to use stored procedure. attached the time elapsed.I did inserted it 11.788 rows in 20"thats it code public void InsertDataBase(MyEntity entity) {...

View Article

Answer by Michał Pilarek for Fastest Way of Inserting in Entity Framework

[NEW SOLUTION FOR POSTGRESQL]Hey, I know it's quite an old post, but I have recently run into similar problem, but we were using Postgresql. I wanted to use effective bulkinsert, what turned out to be...

View Article

Answer by Amir Saniyan for Fastest Way of Inserting in Entity Framework

Use SqlBulkCopy:void BulkInsert(GpsReceiverTrack[] gpsReceiverTracks){ if (gpsReceiverTracks == null) { throw new ArgumentNullException(nameof(gpsReceiverTracks)); } DataTable dataTable = new...

View Article


Answer by Nadeem for Fastest Way of Inserting in Entity Framework

You may use Bulk package library. Bulk Insert 1.0.0 version is used in projects having Entity framework >=6.0.0 .More description can be found here-Bulkoperation source code

View Article

Answer by Jonathan Magnan for Fastest Way of Inserting in Entity Framework

I'm looking for the fastest way of inserting into Entity FrameworkThere are some third-party libraries supporting Bulk Insert available:Z.EntityFramework.Extensions...

View Article


Answer by Greg R Taylor for Fastest Way of Inserting in Entity Framework

Another option is to use SqlBulkTools available from Nuget. It's very easy to use and has some powerful features. Example:var bulk = new BulkOperations();var books = GetBooks();using (TransactionScope...

View Article

Answer by Sgedda for Fastest Way of Inserting in Entity Framework

I have made an generic extension of @Slauma s example above;public static class DataExtensions{ public static DbContext AddToContext<T>(this DbContext context, object entity, int count, int...

View Article


Answer by Aleksa for Fastest Way of Inserting in Entity Framework

All the solutions written here don't help because when you do SaveChanges(), insert statements are sent to database one by one, that's how Entity works. And if your trip to database and back is 50 ms...

View Article

Answer by Mikael Eliasson for Fastest Way of Inserting in Entity Framework

As other people have said SqlBulkCopy is the way to do it if you want really good insert performance.It's a bit cumbersome to implement but there are libraries that can help you with it. There are a...

View Article

Answer by ShaTin for Fastest Way of Inserting in Entity Framework

I would recommend this article on how to do bulk inserts using EF.Entity Framework and slow bulk INSERTsHe explores these areas and compares perfomance:Default EF (57 minutes to complete adding 30,000...

View Article
Browsing all 33 articles
Browse latest View live


Latest Images