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

  • SEARCH
  • Home
  • 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 6063307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:09:04+00:00 2026-05-23T09:09:04+00:00

I have 1M html files that I need to parse and then insert the

  • 0

I have 1M html files that I need to parse and then insert the extracted information into my sql server. Each file parsed out information end up in multiple tables due to relationships among the objects I have parsed out

I am using Entity Framework right now to do this but adding each piece of my information to the proper object on the EF context takes a long time and not efficient! I need this faster especially that I have so many file to process.

What is the fasted way to parse out a lot of file in parallel and insert it in SQL server where items you are adding have relationships?

Also, is there a better technology for this? Like Informatica?

  • 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-05-23T09:09:04+00:00Added an answer on May 23, 2026 at 9:09 am

    I think SqlBulkCopy Class will be the best option in this case.

    You can make a generic wrapper around SqlBulkCopy class, which will allow you to use SqlBulkCopy on any entity. Below is the wrapper for LINQ-to-SQL, but the same idea will work with Entity Framework, with the assumption that your entity mapped to tables one-to-one.

    public void BulkInsert<TBusinessObject>(IEnumerable<TBusinessObject> entities, int timeoutInSeconds)
        where TBusinessObject : class, IBusinessObject
    {
        AssertUtilities.ArgumentAllNotNull(entities, "entities");
        AssertUtilities.ArgumentNotNegative(timeoutInSeconds, "timeoutInSeconds");
    
        var metaTable = Mapping.GetTable(typeof(TBusinessObject));
        if (metaTable == null)
            throw new DataAccessException("MetaTable is not found.");
        var insertDataMembers = metaTable.RowType.PersistentDataMembers
            .Where(arg => !arg.IsDbGenerated)
            .OrderBy(arg => arg.Ordinal)
            .ToList();
        using (var dataTable = new DataTable())
        {
            dataTable.Locale = CultureInfo.InvariantCulture;
            var dataColumns = insertDataMembers
                .Select(arg => new DataColumn(arg.MappedName))
                .ToArray();
            dataTable.Columns.AddRange(dataColumns);
            foreach (var entity in entities)
            {
                var itemArray = insertDataMembers
                    .Select(arg => arg.StorageAccessor.GetBoxedValue(entity))
                    .ToArray();
                dataTable.Rows.Add(itemArray);
            }
            try
            {
                if (Connection.State != ConnectionState.Open)
                    Connection.Open();
                var sqlConnection = (SqlConnection)Connection;
                var sqlTransaction = (SqlTransaction)Transaction;
                using (var bulkCopy = new SqlBulkCopy(sqlConnection, SqlBulkCopyOptions.Default, sqlTransaction))
                {
                    bulkCopy.BulkCopyTimeout = timeoutInSeconds;
                    bulkCopy.DestinationTableName = metaTable.TableName;
                    foreach (var dataColumn in dataColumns)
                        bulkCopy.ColumnMappings.Add(dataColumn.ColumnName, dataColumn.ColumnName);
                    bulkCopy.WriteToServer(dataTable);
                }
            }
            catch (Exception exception)
            {
                throw DataAccessExceptionTranslator.Translate(exception);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large set of HTML files that I need to parse the
We have a need to parse and extract the content from html files. We
I have a large number of HTML files that I need to process with
I have some html files that I want to convert to text. I have
I have a set of html files that I want to modify by replacing
I have some static resources (images and HTML files) that will be localized. One
I have a Delphi program that creates HTML files. Later when a button is
I have a .NET console application that needs to generate some HTML files. I
I have a HTML file that has code similar to the following. <table> <tr>
I have a html file that has invoice details I would like to know

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.