public async Task ExecutePostRegistrationStep(IDIContainer container, CancellationToken cancellationToken = default(CancellationToken)) { var metrics = new Dictionary <string, double>(); var timer = new InlineEventTimer("DefaultDeployment", "InjectRegistrationModule"); var postRegistrationSteps = container.ResolveAllInstances <IPostRegistrationStep>(); if (postRegistrationSteps != null) { var orderedSteps = new SortedDictionary <int, IPostRegistrationStep>(); var count = 1000; foreach (var s in from p in postRegistrationSteps where p.GetType() != GetType() select p) { var step = s.GetType().GetCustomAttribute(typeof(RegistrationStepOrderAttribute)); if (step == null) { orderedSteps.Add(count, s); } else { var order = (step as RegistrationStepOrderAttribute)?.Order; if (order.HasValue) { orderedSteps.Add(order.Value, s); } else { orderedSteps.Add(count, s); } } count++; } foreach (var step in orderedSteps) { if (step.Value != null) { timer.Reset(); await step.Value.ExecutePostRegistrationStep(container, cancellationToken); metrics.Add(step.Value.GetType().Name, timer.Elapsed.TotalMilliseconds); } } } container.Resolve <ILogFactory>()?.CreateLog("DefaultDeployment", "Start")?.Event("Startup Performance", null, metrics); }