AddMethod() public méthode

public AddMethod ( MethodInfo method, string cacheManagerId ) : void
method System.Reflection.MethodInfo
cacheManagerId string
Résultat void
Exemple #1
0
        private void GatherCacheAttributes(CacheConfig config, ComponentModel model)
        {
            MethodInfo[] methods = model.Implementation.GetMethods(
                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            foreach (MethodInfo method in methods)
            {
                if (method.IsDefined(typeof(CacheAttribute), true))
                {
                    CacheAttribute[] attributs      = method.GetCustomAttributes(typeof(CacheAttribute), true) as CacheAttribute[];
                    string           cacheManagerId = attributs[0].CacheManagerId;

                    config.AddMethod(method, cacheManagerId);
                }
            }
        }
		private void GatherCacheAttributes(CacheConfig config, ComponentModel model)
		{
			MethodInfo[] methods = model.Implementation.GetMethods( 
				BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic );

			foreach(MethodInfo method in methods)
			{
				if (method.IsDefined( typeof(CacheAttribute), true ))
				{
					CacheAttribute[] attributs = method.GetCustomAttributes(typeof(CacheAttribute), true) as CacheAttribute[];
					string cacheManagerId = attributs[0].CacheManagerId;

					config.AddMethod( method, cacheManagerId );
				}
			}
		}