Beispiel #1
0
        public override XElement Find(IEnumerable <KeyValuePair <string, string> > keyValues)
        {
            IEnumerable <XElement> elements = XmlProvider.FindElements(keyValues);

            if (elements == null)
            {
                return(null);
            }

            int count = elements.Count();

            if (count == 0)
            {
                throw new ApplicationException(string.Format("Not found the datasource by {0}.", GetKeyValueString(keyValues)));
            }
            if (count > 1)
            {
                throw new ApplicationException(string.Format("Ambiguous datasources have been found by {0}.", GetKeyValueString(keyValues)));
            }

            return(new XElement(elements.First()));
        }
        public override XElement Find(IEnumerable <KeyValuePair <string, string> > keyValues)
        {
            IEnumerable <XElement> elements = XmlProvider.FindElements(keyValues);

            if (elements == null)
            {
                return(null);
            }

            int count = elements.Count();

            //if (count == 0) throw new SchemaException(string.Format(SchemaDeltaMessages.NotFoundDelta, GetKeyValueString(deltaKey)));
            if (count == 0)
            {
                return(null);
            }
            if (count > 1)
            {
                throw new SchemaException(string.Format(SchemaDeltaMessages.AmbiguousDelta, GetKeyValueString(keyValues)));
            }

            return(new XElement(elements.First()));
        }