public static StorageNode BuildNode(Domain parentDomain, NodeConfiguration nodeConfiguration) { ArgumentValidator.EnsureArgumentNotNull(parentDomain, "parentDomain"); ArgumentValidator.EnsureArgumentNotNull(nodeConfiguration, "nodeConfiguration"); nodeConfiguration.Validate(parentDomain.Configuration); if (!nodeConfiguration.IsLocked) { nodeConfiguration.Lock(); } var context = new UpgradeContext(parentDomain, nodeConfiguration); using (context.Activate()) using (context.Services) { new UpgradingDomainBuilder(context).Run(); return(context.StorageNode); } }
public static async Task <StorageNode> BuildNodeAsync( Domain parentDomain, NodeConfiguration nodeConfiguration, CancellationToken token) { ArgumentValidator.EnsureArgumentNotNull(parentDomain, nameof(parentDomain)); ArgumentValidator.EnsureArgumentNotNull(nodeConfiguration, nameof(nodeConfiguration)); nodeConfiguration.Validate(parentDomain.Configuration); if (!nodeConfiguration.IsLocked) { nodeConfiguration.Lock(); } var context = new UpgradeContext(parentDomain, nodeConfiguration); using (context.Activate()) using (context.Services) { await new UpgradingDomainBuilder(context).RunAsync(token).ConfigureAwait(false); return(context.StorageNode); } }