Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8814911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:14:47+00:00 2026-06-14T04:14:47+00:00

I’m using Entity Framework 5 on .NET 4.5 with SQL Server 2012. I have

  • 0

I’m using Entity Framework 5 on .NET 4.5 with SQL Server 2012. I have a function that downloads a lot of data from a 3rd party source and parses it into my database. It downloads, parses to my entities and inserts/updates to my db in batches of 2,500 records.

For the insert/update to my database, I’m making use of the SqlBulkCopy class. When it is doing the insert/update to my database, the table it’s inserting/updating to seems to be partially unresponsive. If I run a simple select query from SSMS it will pull some records and then hang until the app has finished the bulk insert/update. This data in my db is fed to multiple sources via WCF service and if I try to load the data at one of the sources, it times out due to the database not responding with the data. Once the insert/update finishes, the WCF service and SSMS queries both continue to run fine.

I thought this may be due to the SqlBulkCopy so I removed the use of that class and just called a context.SaveChanges() which produces the exact same result. I then ran a test taking EF completely out of the picture and used classic ADO.NET (without SqlBulkCopy) and everything works great. I plugged the SqlBulkCopy back in, left EF out, and again, the table seems to be locked until it finishes.

So I am assuming the culprit here is both EF and SqlBulkCopy. Any ideas on how I can get around this and still use EF and SqlBulkCopy? or what may be causing this to happen?

I don’t think examples of my code are necessary here, but if you would like to see, just let me know. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:14:48+00:00Added an answer on June 14, 2026 at 4:14 am

    I’m thinking this is because of transactions. When you use SqlBukCopy or context.SaveChanges(), the inserts happen within a transaction. When you replaced that code with classic ADO.NET, did you wrap the inserts in a transaction or did you let each Insert occur inside it’s own implicit transaction?

    When a transaction is pending, it locks portions of the table being updated. If it inserts enough data, it might lock a lot of pages in the table or the whole table (this is called lock escalation).

    The best way around this is to split the update into smaller chunks. There are a few other options (e.g. reading uncommitted data, etc.) but those have significant downsides and should typically be avoided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.