Esempio n. 1
0
		/////////////////////////////////////////////////////////////////////////////

		protected void PrePostRenderHandler( bool calledBefore, RazorTemplateBase templateBase ) 
		{
			// ******
			var tBase = templateBase as NmpRazorTemplateBase;

			// ******
			if( calledBefore ) {
				tBase.mp = mp;
			}
			else {
				lastInstance = templateBase;
				AddHelpers( templateBase );
			}

			// ******
			return;
		}
Esempio n. 2
0
		/////////////////////////////////////////////////////////////////////////////

		protected void AddHelpers( RazorTemplateBase templateBase )
		{
		
		//
		// could probably use ETB.CreateMethodInvoker() here
		//

		//
		// methods generated by razor in class that we're adding to NMP in case
		// NMP runs after
		//
		 
			MethodInfo [] methods = templateBase.GetType().GetMethods();
			foreach( var method in methods ) {
				if( typeof(HelperResult) == method.ReturnParameter.ParameterType ) {
					var objInfo = new ObjectInfo( templateBase, method.Name );
					if( objInfo.IsMethod ) {
						mp.AddObjectMacro( method.Name, new MethodInvoker(objInfo) );
					}
				}
			}

			return;
		}