title: How do you manage database connections and transactions across inserts in an Object Oriented way, using VB.net or C#?
body: <p>I'm to the point now in my programming development that I'm trying to take advantage of Object Oriented Design instead of the basic behind the button procedural stuff I have been doing.  </p>
  
  <p>In a current project I'm taking repeated, copy and paste sql server insert code and migrating it to classes with properties, methods, etc...  </p>
  
  <p>One issue I'm getting stuck at is how to keep connections to the database low, while doing inserts across multiple objects, and therefore multiple tables.</p>
  
  <p>In a procedural way I've been using an ADO.net transaction to write to one table, then based on the inserted record's ID, write additional information to another table -- without closing the connection until the second job is done.  I use the transaction so if the later insert fails, the first insert can be undone, and using try, catch, finally to close the connection whether it succeeds or fails.</p>
  
  <p>How do you handle this in the object oriented world?</p>
  
  <p>EDIT: Thanks to everyone's answers.  I get it.  Here's another question that also helped to clarify it for me: <a href="https://stackoverflow.com/questions/334729/asp-net-ado-net-handling-many-database-connections-inside-a-net-object">ASP.NET/ADO.NET: Handling many database connections inside a .NET Object?</a></p>