public static Dictionary <string, List <string> > GetPropertyInfluences(Type t)
        {
            Dictionary <string, List <string> > map = new Dictionary <string, List <string> >();

            try
            {
                foreach (PropertyInfo pi in t.GetProperties().Where(q => q.IsVirtual()))
                {
                    var analyzer = new PropertyDependencyAnalyzer(pi.GetGetMethod());
                    foreach (var methodBase in analyzer)
                    {
                        if (methodBase.DeclaringType == t && methodBase.IsSpecialName && methodBase.Name.StartsWith("get_"))
                        {
                            // property dependency found
                            StoreFound(map, pi.Name, methodBase.Name.Substring(4));
                        }
                    }
                }
            }
            catch
            {
                //ignore IL exception
            }
            return(map);
        }
Esempio n. 2
0
        public static Type AutoNotifier(Type t)
        {
            if (NothingToDo.With(t))
            {
                return(t);
            }
            Prerequisites.ThrowIfNotSatisfiedBy(t);
            var influences = PropertyDependencyAnalyzer.GetPropertyInfluences(t);

            return(ProxyGen.GetFor(t, influences));
        }