Пример #1
0
        public FeaturesViewEngine()
        {
            ViewLocationCache = new DefaultViewLocationCache();

            var featureFolders = new[]
            {
                "~/Features/%1/{1}/{0}.cshtml",
                "~/Features/%1/%2/{1}/{0}.cshtml",
                "~/Features/%1/{0}.cshtml",
                "~/Features/%1/%2/{0}.cshtml",
                "~/Cms/%1/{1}/{0}.cshtml",
                "~/Commerce/%1/{1}/{0}.cshtml",
                "~/Social/%1/{1}/{0}.cshtml"
            };

            featureFolders = featureFolders.Union(AdditionalPartialViewFormats).ToArray();

            ViewLocationFormats = ViewLocationFormats
                                  .Union(featureFolders)
                                  .ToArray();

            PartialViewLocationFormats = PartialViewLocationFormats
                                         .Union(featureFolders)
                                         .ToArray();

            MasterLocationFormats = MasterLocationFormats
                                    .Union(featureFolders)
                                    .ToArray();
        }
Пример #2
0
    /*==========================================================================================================================
    | CONSTRUCTOR
    \-------------------------------------------------------------------------------------------------------------------------*/
    /// <summary>
    ///   Initializes a new instance of <see cref="TopicViewEngine"/>.
    /// </summary>
    /// <remarks>
    ///   When instantiated, the <see cref="TopicViewEngine.TopicViewEngine"/> constructor will initialize location formats with
    ///   extensions intended to support organizing views by <see cref="Topic.ContentType"/>.
    /// </remarks>
    public TopicViewEngine(IViewPageActivator viewPageActivator = null) : base(viewPageActivator) {

      /*------------------------------------------------------------------------------------------------------------------------
      | Define view location
      >-------------------------------------------------------------------------------------------------------------------------
      | Supports the following replacement tokens: {0} Controller, {1} View, {2} Area, and {3} Content Type.
      \-----------------------------------------------------------------------------------------------------------------------*/
      var viewLocations = new[] {
        "~/Views/{3}/{1}.cshtml",
        "~/Views/ContentTypes/{3}.{1}.cshtml",
        "~/Views/ContentTypes/{1}.cshtml",
        "~/Views/Shared/{1}.cshtml",
      };

      /*------------------------------------------------------------------------------------------------------------------------
      | Set view locations
      \-----------------------------------------------------------------------------------------------------------------------*/
      ViewLocationFormats = ViewLocationFormats.Union(viewLocations).ToArray();
      MasterLocationFormats = MasterLocationFormats.Union(viewLocations).ToArray();
      PartialViewLocationFormats = PartialViewLocationFormats.Union(viewLocations).ToArray();

      /*------------------------------------------------------------------------------------------------------------------------
      | Update view locations for areas
      \-----------------------------------------------------------------------------------------------------------------------*/
      viewLocations = viewLocations.Select(v => v.Replace("~", "~/{2}/")).ToArray();

      /*------------------------------------------------------------------------------------------------------------------------
      | Set area view locations
      \-----------------------------------------------------------------------------------------------------------------------*/
      AreaViewLocationFormats = AreaViewLocationFormats.Union(viewLocations).ToArray();
      AreaMasterLocationFormats = AreaMasterLocationFormats.Union(viewLocations).ToArray();
      AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Union(viewLocations).ToArray();

    }
Пример #3
0
 public EPiServerViewEngine()
 {
     this.PartialViewLocationFormats     = PartialViewLocationFormats.Union(ViewFormats).ToArray();
     this.ViewLocationFormats            = ViewLocationFormats.Union(ViewFormats).ToArray();
     this.AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Union(AreaViewFormats).ToArray();
     this.AreaViewLocationFormats        = AreaViewLocationFormats.Union(AreaViewFormats).ToArray();
     this.AreaMasterLocationFormats      = AreaMasterViewFormats.Union(AreaMasterViewFormats).ToArray();
     this.MasterLocationFormats          = MasterLocationFormats.Union(MasterViewFormats).ToArray();
 }
Пример #4
0
        public FeatureViewEngine()
        {
            var featureFolderViewLocationFormats = new[]
            {
                "~/Features/{0}.cshtml",
                "~/Features/{1}/{0}.cshtml",
                "~/Features/{1}/Views/{0}.cshtml"
            }
            .Union(FeatureFolders())
            .ToArray();

            ViewLocationFormats        = ViewLocationFormats.Union(featureFolderViewLocationFormats).ToArray();
            MasterLocationFormats      = MasterLocationFormats.Union(featureFolderViewLocationFormats).ToArray();
            PartialViewLocationFormats = PartialViewLocationFormats.Union(featureFolderViewLocationFormats).ToArray();
        }
Пример #5
0
        public MultiDeviceRazorViewEngine()
        {
            var newViewLocations = new[]
            {
                "~/Views/{1}/{0}/{0}.cshtml",
                "~/Views/{1}/{0}/Partials/{0}.cshtml",
                "~/Views/{1}/Partials/{0}.cshtml",
                "~/Views/{1}/Partials/{0}/{0}.cshtml",
                "~/Views/Shared/{0}/{0}.cshtml",
                "~/Views/Shared/Partials/{0}.cshtml",
                "~/Views/Shared/Partials/{0}/{0}.cshtml"
            };

            ViewLocationFormats        = ViewLocationFormats.Union(newViewLocations).ToArray();
            MasterLocationFormats      = MasterLocationFormats.Union(newViewLocations).ToArray();
            PartialViewLocationFormats = PartialViewLocationFormats.Union(newViewLocations).ToArray();
        }