DotNetNuke Extension Development Best Practices Mitchel Sellers Microsoft C# MVP, MCITP
About Mitchel DotNetNuke Core Team Member Microsoft C# MVP Microsoft Certified Professiona CEO of IowaComputerGurus Blog: Modules:
Agenda Source of Recommendations Module Architecture/Packaging Being a Good DNN Citizen o Basics o Controls o Entities o Interfaces o User Interface Security & Data Isolation
Source of Recommendations No Existing All Encompassing Best Practice Guide DNN “Secure Module” guide o Covers mostly standard.NET guidance o Not specific enough, or current ICG DNN Module Best Practices Guide o Proven practices used in our business o Based on concept of “playing well”
Module Architecture Web Application Project (WAP) o Compiled Module o Non-Source Module Folder Naming o Consistency o /DesktopModules is shared o /CompanyName/ModuleName Manifest Naming
Module Packaging Package for Minimum Supported DNN Version Ensure.dnn file Limits Versions o 4.x Use [MatchRegex] o 5.x Use Ensure Package Names Unique to Business Ensure to register any dependencies o DNN 5.x class name, or package name o DNN 4.x class name
Being a Good DNN Citizen Support {objectQualifier} and {databaseOwner} Support localization of all static text elements Use NVARCHAR for all database columns for international character support Avoid modifying the web.config if possible
Good DNN Citizen (Controls) Utilize common DNN Elements o LabelControl.ascx o TextEditor.ascx o UrlControl.ascx o SectionHead.ascx o DotNetNuke Web Controls Assembly (Pager, Profile Editor, etc.) Provide a consistent, familiar process, improves usability
DNN Controls Examples
Good DNN Citizen (Entities) Utilize DNN API Entities for Data Manipulation o DotNetNuke.Entities.Portals o DotNetNuke.Entities.Tabs o DotNetNuke.Entities.Users o DotNetNuke.Entities.Modules o DotNetNuke.Security.Roles Reduces exposure to risks with DNN upgrades and breaking DB changes
Good DNN Citizen (Interfaces) Implement Consistent Interfaces for Interaction o IPortable – Import/Export o ISearchable – Core Search Integration o IActionable – Module Actions o IUpgradable – Upgrading Modules Not always the 100% solution o IPortable designed for module content only, but can be “modified”
Good Citizen (UI) Ensure all ASP.NET Validators Have Validation Group Use standard DotNetNuke CSS Classes o Normal – Regular Text o NormalRed – Error Text o SubHead – Labels o Head – Section heading
Security and Data Isolation Properly Tie Data o PortalId, ModuleId, TabModuleId? Which one o Auto-Cleanup? DotNetNuke PortalSecurity Object o Input Filter (FilterFlag.NoScripting, FilterFlag.NoMarkup) objSecurity.InputFilter(“TextToFilter”, FilterFlag.NoMarkup) Respect Host File Types o This.PortalSettings.HostSettings("FileExtensions")
Resources/Contact Blog: Company: ICG DNN Dev Best Practices: DotNetNuke Securing Modules: