Exemple #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));
        }
Exemple #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);
        }
Exemple #3
0
 private void AddDependency(ConfigureMethodInfo dependency)
 {
     _dependencies.Add(dependency);
 }
Exemple #4
0
 internal void AddDependent(ConfigureMethodInfo dependent)
 {
     _dependents.Add(dependent);
     dependent.AddDependency(this);
 }