Created
May 17, 2011 16:15
-
-
Save gamlerhart/976768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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