diff --git a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs deleted file mode 100644 index 8d044ea8dd..0000000000 --- a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Web.Mvc; -using Microsoft.Extensions.DependencyInjection; -using Umbraco.Web.Routing; -using Umbraco.Core; -using Umbraco.Core.Composing; -using Umbraco.Core.Models.PublishedContent; -using Current = Umbraco.Web.Composing.Current; - -namespace Umbraco.Web.Mvc -{ - /// - /// Used for custom routed pages that are being integrated with the Umbraco data but are not - /// part of the umbraco request pipeline. This allows umbraco macros to be able to execute in this scenario. - /// - /// - /// This is inspired from this discussion: - /// https://our.umbraco.com/forum/developers/extending-umbraco/41367-Umbraco-6-MVC-Custom-MVC-Route?p=3 - /// - /// which is based on custom routing found here: - /// http://shazwazza.com/post/Custom-MVC-routing-in-Umbraco - /// - public class EnsurePublishedContentRequestAttribute : ActionFilterAttribute - { - // TODO: Need to port this to netcore and figure out if its needed or how this should work (part of a different task) - - //private readonly string _dataTokenName; - //private IUmbracoContextAccessor _umbracoContextAccessor; - //private readonly int? _contentId; - //private IPublishedContentQuery _publishedContentQuery; - - ///// - ///// Constructor - can be used for testing - ///// - ///// - ///// - //public EnsurePublishedContentRequestAttribute(IUmbracoContextAccessor umbracoContextAccessor, int contentId) - //{ - // _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); - // _contentId = contentId; - //} - - ///// - ///// A constructor used to set an explicit content Id to the PublishedRequest that will be created - ///// - ///// - //public EnsurePublishedContentRequestAttribute(int contentId) - //{ - // _contentId = contentId; - //} - - ///// - ///// A constructor used to set the data token key name that contains a reference to a PublishedContent instance - ///// - ///// - //public EnsurePublishedContentRequestAttribute(string dataTokenName) - //{ - // _dataTokenName = dataTokenName; - //} - - ///// - ///// Constructor - can be used for testing - ///// - ///// - ///// - //public EnsurePublishedContentRequestAttribute(IUmbracoContextAccessor umbracoContextAccessor, string dataTokenName) - //{ - // _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); - // _dataTokenName = dataTokenName; - //} - - ///// - ///// Exposes the UmbracoContext - ///// - //protected IUmbracoContext UmbracoContext => _umbracoContextAccessor?.UmbracoContext ?? Current.UmbracoContext; - - //// TODO: try lazy property injection? - //private IPublishedRouter PublishedRouter => Current.Factory.GetRequiredService(); - - //private IPublishedContentQuery PublishedContentQuery => _publishedContentQuery ?? (_publishedContentQuery = Current.Factory.GetRequiredService()); - - //public override void OnActionExecuted(ActionExecutedContext filterContext) - //{ - // base.OnActionExecuted(filterContext); - - // // First we need to check if the published content request has been set, if it has we're going to ignore this and not actually do anything - // if (Current.UmbracoContext.PublishedRequest != null) - // { - // return; - // } - - // Current.UmbracoContext.PublishedRequest = PublishedRouter.CreateRequest(Current.UmbracoContext); - // ConfigurePublishedContentRequest(Current.UmbracoContext.PublishedRequest, filterContext); - //} - - ///// - ///// This assigns the published content to the request, developers can override this to specify - ///// any other custom attributes required. - ///// - ///// - ///// - //protected virtual void ConfigurePublishedContentRequest(IPublishedRequest request, ActionExecutedContext filterContext) - //{ - // if (_contentId.HasValue) - // { - // var content = PublishedContentQuery.Content(_contentId.Value); - // if (content == null) - // { - // throw new InvalidOperationException("Could not resolve content with id " + _contentId); - // } - // request.PublishedContent = content; - // } - // else if (_dataTokenName.IsNullOrWhiteSpace() == false) - // { - // var result = filterContext.RouteData.DataTokens[_dataTokenName]; - // if (result == null) - // { - // throw new InvalidOperationException("No data token could be found with the name " + _dataTokenName); - // } - // if (result is IPublishedContent == false) - // { - // throw new InvalidOperationException("The data token resolved with name " + _dataTokenName + " was not an instance of " + typeof(IPublishedContent)); - // } - // request.PublishedContent = (IPublishedContent)result; - // } - - // PublishedRouter.PrepareRequest(request); - //} - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b56b4b1450..efdcbba045 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -173,7 +173,6 @@ -