Agility.AspNetCore

Follow

We are pleased to announce that Agility.Web for ASP.NET Core is now available as a pre-release package from nuget.org. There are minimal structural changes in how things work in comparison to ASP.NET MVC.

Instance-Specific Agility Configuration

What used to be Web.config in a traditional ASP.NET MVC app is now replaced with appsettings.json in ASP.NET Core and it will look like the following for agility configuration:

{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "Agility": {
    "applicationName": "Sample Website (Local)",
    "websiteName": "Sample Website",
    "securityKey": "your instance's security code",
    "contentCacheFilePath": "/home/AgilityContent/",
    "contentServerUrl": "https://contentserver-ca.agilitycms.com/agilitycontentserver.svc",
    "developmentMode": "false",
    "Trace": {
      "traceLevel": "Verbose",
      "logFilePath": "/home/AgilityLogs/AgilityWebsite.log"
    },
    "UGC": {
      "Url": "http://ugc-ca.agilitycms.com/Agility-UGC-API-JSONP.svc",
      "Key": "your ugc key",
      "Password": "your ugc password"
    }
  }

}

Registering Agility Routes

Default Agility Routes for the Page Tree are registered in Configure method of ASP.NET Core projects Startup.cs file as follows:

app.UseMvc(routes =>
{
    //Agility Builtin Route
    routes.MapRoute("Agility", "{*sitemapPath}", new { controller = "Agility", action = "RenderPage" },
        new { isAgilityPath = new Agility.Web.Mvc.AgilityRouteConstraint() });


    routes.MapRoute(
        name: "default",
        template: "{controller=Home}/{action=Index}/{id?}");
});

Module Setup with ViewComponents

In a traditional ASP.NET MVC project, Controllers and Actions are used to render Agility Modules. ASP.NET Core replaces them with ViewComponents. Using ViewComponents enables Agility.Web for ASP.NET Core to render modules on a page asynchronously.

The above code snippet would look like the following snippet in an ASP.NET MVC project.

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.