Skip to content

Instantly share code, notes, and snippets.

@gamlerhart
Created May 17, 2011 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamlerhart/976768 to your computer and use it in GitHub Desktop.
Save gamlerhart/976768 to your computer and use it in GitHub Desktop.
public static class Db4oExtensions
{
public static void InTransaction(this IObjectContainer container,
Action<IObjectContainer> txClosure )
{
InTransaction(container, c =>
{
txClosure(c);
return true;
});
}
public static T InTransaction<T>(this IObjectContainer container,
Func<IObjectContainer,T> txClosure)
{
try
{
return txClosure(container);
}
finally
{
container.Commit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment