Example #1
0
        public Dictionary <IPath, IList <object> > SelectEnumerablesAsRelated(IList <IPath> paths, object data)
        {
            Dictionary <IPath, IList <object> > values;

            if (paths.Count > 0)
            {
                IInterrogator interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
                INavigator    navigator    = interrogator.CreateNavigator(data, paths[0].GetType());

                if (navigator == null)
                {
                    throw new Exception(string.Concat("Couldn't create a navigator for the path '", paths[0].ToString(),
                                                      "'."));
                }

                values = navigator.SelectEnumerablesAsRelated(paths);

                navigator.Dispose();
            }
            else
            {
                values = new Dictionary <IPath, IList <object> >();
            }

            return(values);
        }
Example #2
0
        public Dictionary <IPath, IList <object> > SelectEnumerablesAsRelated(IList <IPath> paths, object data)
        {
            Dictionary <IPath, IList <object> > values;

            if (paths.Count > 0)
            {
                var interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
                var navigator    = interrogator.CreateNavigator(data, paths[0].GetType());

                if (navigator == null)
                {
                    throw new Exception(string.Format(ErrorResource.CouldntCreateNavigator, paths[0]));
                }

                values = navigator.SelectEnumerablesAsRelated(paths);

                navigator.Dispose();
            }
            else
            {
                values = new Dictionary <IPath, IList <object> >();
            }

            return(values);
        }
Example #3
0
        public IEnumerable <IPath> Map(object data)
        {
            var interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
            var mapper       = interrogator.CreateMapper(data);

            if (mapper == null)
            {
                throw new Exception(string.Format(ErrorResource.CouldntCreateMapper, data));
            }

            return(mapper.Map(data));
        }
Example #4
0
        public IEnumerable <IPath> Map(object data)
        {
            IInterrogator interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
            IMapper       mapper       = interrogator.CreateMapper(data);

            if (mapper == null)
            {
                throw new Exception(string.Concat("Couldn't create a mapper for '", data.ToString(), "'."));
            }

            return(mapper.Map(data));
        }
Example #5
0
        public IEnumerable <object> SelectEnumerable(IPath path, object data)
        {
            var interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
            var navigator    = interrogator.CreateNavigator(data, path.GetType());

            if (navigator == null)
            {
                throw new Exception(string.Format(ErrorResource.CouldntCreateNavigator, path));
            }

            var values = navigator.SelectEnumerable(path);

            navigator.Dispose();

            return(values);
        }
Example #6
0
        public IEnumerable <object> SelectEnumerable(IPath path, object data)
        {
            IInterrogator interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
            INavigator    navigator    = interrogator.CreateNavigator(data, path.GetType());

            if (navigator == null)
            {
                throw new Exception(string.Concat("Couldn't create a navigator for the path '", path.ToString(), "'."));
            }

            IEnumerable <object> values = navigator.SelectEnumerable(path);

            navigator.Dispose();

            return(values);
        }
Example #7
0
        public object SelectScalar(IPath path, object data)
        {
            IInterrogator interrogator = InterrogatorFactory.CreateInteregator(data.GetType());
            INavigator    navigator    = interrogator.CreateNavigator(data, path.GetType());

            if (navigator == null)
            {
                throw new Exception(string.Format(ErrorResource.CouldntCreateNavigator, path));
            }

            object value = navigator.SelectScalar(path);

            navigator.Dispose();

            return(value);
        }