public static PropertyAccessTree Analyze <T>(Expression <Func <T> > expression) { log.Trace("Analysis starting"); ExpressionAnalyzer analyzer = new ExpressionAnalyzer() { current_branch_nodes = new Stack <Node>(), tree = new PropertyAccessTree() }; log.Trace("Building property access tree"); analyzer.Visit(expression); if (analyzer.current_branch_nodes.Count > 0) { throw new Exception("Nodes left after analysis"); } analyzer.CleanupTree(analyzer.tree.Children); analyzer.FilterTree(analyzer.tree.Children, TypeHelper.DoesTypeImplementINotifyPropertyChangedAndChanging); log.Trace("Analysis done"); analyzer.tree.DumpToLog(); return(analyzer.tree); }
public static PropertyAccessTree Analyze <T, TResult>(Expression <Func <T, TResult> > expression) { log.Trace("Analysis starting"); ExpressionAnalyzer analyzer = new ExpressionAnalyzer() { current_branch_nodes = new Stack <Node>(), tree = new PropertyAccessTree() }; log.Trace("Building property access tree"); analyzer.Visit(expression); analyzer.tree.DumpToLog(); log.Trace("Cleaning up tree"); analyzer.CleanupTree(analyzer.tree.Children); analyzer.tree.DumpToLog(); log.Trace("Filtering tree"); analyzer.FilterTree(analyzer.tree.Children, DoesTypeImplementINotifyPropertyChangedAndChanging); analyzer.tree.DumpToLog(); log.Trace("Analysis done"); return(analyzer.tree); }