private void SetupSystem()
{
using (var transaction = Database.CreateSafeTransaction(IsolationLevel.Serializable)) {
try {
using (var session = new SystemSession(transaction, SystemSchema.Name)) {
using (var query = session.CreateQuery()) {
foreach (var feature in Database.System.Features) {
try {
feature.OnSystemEvent(SystemEventType.TableCompositeSetup, query);
} catch (Exception ex) {
query.Context.OnError(
new Exception(
String.Format("The feature {0} (v{1}) caused an error on Composite-Setup event.", feature.FeatureName,
feature.Version), ex));
throw;
}
}
}
}
// Commit and close the transaction.
transaction.Commit();
} catch (TransactionException e) {
throw new InvalidOperationException("Transaction Exception initializing the system.", e);
}
}
}