예제 #1
0
 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>());
 }
예제 #2
0
 public static IEnumerable <AttributeSpecification> GetAttributeUpdates(this XPathNavigator navigator)
 {
     return(navigator.AsNamespaceScopedNavigator()
            .Select($"@*[namespace-uri()!='{Constants.NAMESPACE_URI}']")
            .Cast <XPathNavigator>()
            .Select(AttributeSpecificationFactory.Create));
 }
예제 #3
0
        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.")
            });
예제 #4
0
 public static string GetCommandType(this XPathNavigator navigator)
 {
     return(navigator.AsNamespaceScopedNavigator().SelectSingleNode($"@{Constants.NAMESPACE_URI_PREFIX}:{XmlAttributeNames.ACTION}")?.Value);
 }