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 7696103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:42:06+00:00 2026-05-31T21:42:06+00:00

I have a logging class that stores entries in a datatable dt. I then

  • 0

I have a logging class that stores entries in a datatable dt. I then use SQLBULKCOPY to write that dt out to a sql table. Basic stuff. Problem is, I’d like to only call SQLBULKCOPY when there’s say 50 entries in the dt. The problem is, what if I’m done (either intentionally or not, like if the code block that’s using the log class throws an exception) with the logging object and there are still 15 rows in the dt?

What I’d like to do is have some “finalize” code in the log class itself that calls the log class’s own method that writes those 15 records from the dt using sqlbulkcopy. I know overriding Dispose/Finalize methods really isn’t meant for my situation. And it isn’t feasible to use some kind of external-to-the-logging-class way, like giant try/catches that always can call a fake finalize method. (Reason being there might be 4 or 5 layers of nested classes with numerous try/catches, using’s, etc.)

Any ideas?

  • 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-31T21:42:08+00:00Added an answer on May 31, 2026 at 9:42 pm

    Why not implement the IDisposable pattern?

    If you are intentionally shutting down, you can call .Dispose, and if you are unexpectedly shutting down, you can clean up in .Dispose(False).

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

Sidebar

Related Questions

Currently I have a static class that I use as my logging module. I’ve
I have written a class that will handle internal logging in my application. Now
Hopefully someone here can help me out - basically I have a logging class
So I have a class with three fields that maps to a table using
I have a script running every hour that stores log data in a logging
I have a logging class that, well, logs things. I would like to add
I have a static object defined in my logging class, along the lines of:
At the company I work for, I have created a Error Logging class to
I am writing a C# application. I have (a kind of) logging class. and
I have a logging table which has three columns. One column is a unique

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.