Example #1
0
        private static ConfigureMethodInfo CacheIn(IDictionary <Tuple <int, Type>, ConfigureMethodInfo> cache, Tuple <Type, ConfigurePriority, string> configureInfo)
        {
            var configure    = new ConfigureMethodInfo(configureInfo);
            var configureKey = Tuple.Create(configure.Method.MetadataToken, configure.Type);

            return(cache.GetValueOrAdd(configureKey, configure));
        }
Example #2
0
        private static int CalculateWeight(ConfigureMethodInfo method, IDictionary <ConfigureMethodInfo, int> weightCache)
        {
            int weight;

            if (!weightCache.TryGetValue(method, out weight))
            {
                weight = method.Dependents.Count() + method.Method.GetPriority().Priority * -1;
                foreach (var dependent in method.Dependents)
                {
                    weight += CalculateWeight(dependent, weightCache);
                }
                weightCache[method] = weight;
            }
            return(weight);
        }
Example #3
0
 private void AddDependency(ConfigureMethodInfo dependency)
 {
     _dependencies.Add(dependency);
 }
Example #4
0
 internal void AddDependent(ConfigureMethodInfo dependent)
 {
     _dependents.Add(dependent);
     dependent.AddDependency(this);
 }