Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

dotnetnuke - 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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...