コード例 #1
0
        public TraversedDatasourceResult GetDataSource(DesignTimeDataSourceDefinition definition)
        {
            var rootDatasource = GetDataSourceWithoutTraversal(definition);

            // Traverse Relation Path
            var targetDataSource = ObjectGraphPathTraverser.TraversePath(rootDatasource, definition.DataSourceRelationPath);

            // Assign Datasource Types to DesignTimeDatasource, not that we've obtained the datasource & traversed the relation path
            definition.RootDataSourceType = null;
            definition.DataSourceType     = null;

            if (rootDatasource != null)
            {
                definition.RootDataSourceType = rootDatasource.GetType();
            }
            if (targetDataSource != null)
            {
                definition.DataSourceType = targetDataSource.GetType();
            }

            return(new TraversedDatasourceResult(definition, rootDatasource, targetDataSource));
        }
コード例 #2
0
        public static object TraversePath(object dataSource, string path)
        {
            var traverser = new ObjectGraphPathTraverser(dataSource, path);

            return(traverser.Traverse());
        }