Search code examples
upgradedotnetnuke

DNN deprecated methods on upgrade


I'm trying to upgrade my old DNN website to DNN version 9.8.0. The problem is that I have one custom module installed and it is using deprecated methods that I'm resolving using the table of deprecated methods and I ran on one issue that I don't really understand what to do with it:

retRole = DotNetNuke.Security.Roles.RoleProvider.Instance().GetRole(module.PortalId, roleid);

Error is: 'DotNetNuke.Security.Roles.RoleProvider' does not contain a definition for 'GetRole' and no extension method 'GetRole' accepting a first argument of type 'DotNetNuke.Security.Roles.RoleProvider' could be found (are you missing a using directive or an assembly reference?)

In the table of deprecated method, for public virtual RoleInfo GetRole(int portalId, int roleId) it says: Deprecated in DotNetNuke 6.2. Roles are cached in the business layer

Does anyone knows what it means and how to resolve this?


Solution

  • Instead of using the RoleProvider, I would use the RoleController:

    retRole = DotNetNuke.Security.Roles.RoleController.Instance().GetRoleById(module.PortalId, roleid);

    In DNN9.8, RoleProvider doesn't have the method GetRole anymore.