Will the Spark view engine interoperate with webforms master pages?

后端 未结 5 749
孤城傲影
孤城傲影 2021-01-23 22:31

I really like Spark, but we\'ve already got a big investment in webforms based views. I\'d like to start using Spark without having to convert all my existing views up front.

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-23 22:49

    The way I've accomplished this was to move most of the content of my master page into partial views, and then have two master pages: Foo.Master, and Foo.Master.spark that both use the same Html.RenderPartial() calls. Both masters have the same named content areas. This lets me use either engine for a given view and makes the duplication as small as possible.

    An individual view engine is expected to handle both its master and view. The call to IViewEngine is:

    FindView(System.Web.Mvc.ControllerContext controllerContext, string viewName, string masterName, bool useCache)
    

    It does not render the master separate from the view.

    Spark uses this to compile the master into the view and other tricks with its multi-pass rendering.

提交回复
热议问题