コード例 #1
0
		public override void Release(ViewComponent instance)
		{
			if (kernel.HasComponent(instance.GetType()))
			{
				kernel.ReleaseComponent(instance);
			}
			else
			{
				base.Release(instance);
			}
		}
コード例 #2
0
		/// <summary>
		/// Initialize the view component with mock services it needs to 
		/// be functional.
		/// </summary>
		/// <param name="component">The component instance.</param>
		protected void PrepareViewComponent(ViewComponent component)
		{
			if (Context == null)
			{
				BuildEngineContext("", "Controller", "Action");
			}

			viewEngine = BuildViewEngine();

			componentContext = BuildViewComponentContext(component.GetType().Name);

			component.Init(Context, componentContext);
		}
コード例 #3
0
ファイル: ViewComponentInfo.cs プロジェクト: Eilon/spark
 public ViewComponentInfo(ViewComponent component)
 {
     Type = component.GetType();
     Details = Type.GetCustomAttributes(typeof(ViewComponentDetailsAttribute), false).OfType<ViewComponentDetailsAttribute>().FirstOrDefault();
     Instance = component;
 }