public static IEnumerable <string> GetDiscriminants(this XPathNavigator navigator) { return(navigator.AsNamespaceScopedNavigator() .SelectSingleNode($"@{Constants.NAMESPACE_URI_PREFIX}:{XmlAttributeNames.DISCRIMINANT}")?.Value .Split(new[] { Constants.DISCRIMINANT_SEPARATOR }, StringSplitOptions.RemoveEmptyEntries) ?? Enumerable.Empty <string>()); }
public static IEnumerable <AttributeSpecification> GetAttributeUpdates(this XPathNavigator navigator) { return(navigator.AsNamespaceScopedNavigator() .Select($"@*[namespace-uri()!='{Constants.NAMESPACE_URI}']") .Cast <XPathNavigator>() .Select(AttributeSpecificationFactory.Create)); }
public static ConfigurationCommand Create(XPathNavigator navigator) { var namespaceScopedNavigator = navigator.AsNamespaceScopedNavigator(); var commandType = namespaceScopedNavigator.GetCommandType(); return(commandType switch { CommandTypeNames.INSERT => CreateElementInsertionCommand(namespaceScopedNavigator), CommandTypeNames.UPDATE => CreateElementUpdateCommand(namespaceScopedNavigator), CommandTypeNames.UPSERT => CreateElementUpsertionCommand(namespaceScopedNavigator), CommandTypeNames.DELETE => CreateElementDeletionCommand(namespaceScopedNavigator), _ => throw new InvalidOperationException($"The command '{commandType}' is not supported.") });
public static string GetCommandType(this XPathNavigator navigator) { return(navigator.AsNamespaceScopedNavigator().SelectSingleNode($"@{Constants.NAMESPACE_URI_PREFIX}:{XmlAttributeNames.ACTION}")?.Value); }