예제 #1
0
        public object[] Deserialize(Stream message)
        {
            var namespaces = GetNamespaces(new object[0]);
            var document   = XDocument.Load(XmlReader.Create(message));

            if (document.Root == null)
            {
                throw new SerializationException("document doesn't have root element");
            }

            if (document.Root.Name != namespaces["esb"] + "messages")
            {
                throw new SerializationException("message doesn't have root element named 'messages'");
            }

            var msgs = new List <object>();

            foreach (var element in document.Root.Elements())
            {
                var type = reflection.GetType(element.Name.NamespaceName);
                if (type == null)
                {
                    throw new SerializationException("Cannot find root message type: " + element.Name.Namespace);
                }
                var msg = ReadObject(type, element);
                msgs.Add(msg);
            }
            return(msgs.ToArray());
        }
예제 #2
0
        public object GetDataFromParent(int parentId, string propertyToFind)
        {
            var types       = _helper.GetTypesFromAssembly(_domainAssemblyName);
            var entityType  = _helper.GetType(types, _entityModelType);
            var repository  = CreateRepositoryFromEntityType(entityType);
            var resultValue = QueryValueFromParent(repository, parentId, propertyToFind);

            return(resultValue);
        }