Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mani 6 posts 106 karma points
    Jun 30, 2021 @ 15:32
    Mani
    0

    SurfaceController

    This is probably a very basic question and there may be a very simple solution, but I cannot seem to be able to use SurfaceController on V9, I get the following error

    "Severity   Code    Description Project File    Line    Suppression State
    Error   CS7036  There is no argument given that corresponds to the required formal parameter 'umbracoContextAccessor' of 'SurfaceController.SurfaceController(IUmbracoContextAccessor, IUmbracoDatabaseFactory, ServiceContext, AppCaches, IProfilingLogger, IPublishedUrlProvider)'
    "
    

    Thank you so much in advance. Mani

  • Nikolaj Lauridsen 3 posts 94 karma points hq
    Jul 01, 2021 @ 07:37
    Nikolaj Lauridsen
    100

    How does your constructor look? A new thing in V9 is that you need to call the constructor of the base class with the parameters it wants, your constructor should look something like:

    using Umbraco.Cms.Core.Cache;
    using Umbraco.Cms.Core.Logging;
    using Umbraco.Cms.Core.Routing;
    using Umbraco.Cms.Core.Services;
    using Umbraco.Cms.Core.Web;
    using Umbraco.Cms.Infrastructure.Persistence;
    using Umbraco.Cms.Web.Website.Controllers;
    
    namespace RoutingDocs.Controllers
    {
        public class MyController : SurfaceController
        {
            public MyController(
                IUmbracoContextAccessor umbracoContextAccessor,
                IUmbracoDatabaseFactory databaseFactory,
                ServiceContext services,
                AppCaches appCaches,
                IProfilingLogger profilingLogger,
                IPublishedUrlProvider publishedUrlProvider)
                : base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider)
            {
            }
        }
    }
    
  • Mani 6 posts 106 karma points
    Jul 01, 2021 @ 08:53
    Mani
    1

    Thank you so much Nikolaj, that solved the issue.

  • Nikolaj Lauridsen 3 posts 94 karma points hq
    Jul 01, 2021 @ 08:57
    Nikolaj Lauridsen
    0

    No problem, glad it helped 😀

Please Sign in or register to post replies

Write your reply to:

Draft