1 / 21

Module Programming 101

Scott Wilkinson @DotNetNuclear. Module Programming 101 . Outline. IIS Setup and DNN install Install Christoc’s DNN7, DAL2 Template using vsix install Create RestaurantMenu project Build project in Release mode (fix missing /package folder issue if applicable)

kara
Télécharger la présentation

Module Programming 101

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scott Wilkinson @DotNetNuclear Module Programming 101

  2. Outline IIS Setup and DNN install Install Christoc’s DNN7, DAL2 Template using vsix install Create RestaurantMenu project Build project in Release mode (fix missing /package folder issue if applicable) Find RestaurantMenu Source package and install in DNN Demonstrate the default Item Module functionality and discuss the basics view controls of the template: view, edit, settings (DotNetNuke.Entities.Modules.PortalModuleBase) Build Database scripts Build DAL2 model: RestaurantMenuItem.cs Build DAL2 controller: RestaurantMenuItemRepository.cs Comment out broken code in the edit control and build project in Debug Discuss debugging Build ‘edit’ view [Breakout: student do 30 minutes of coding on their own] Discuss: Use ClientResourceManagement to register scripts and css Discuss: UI guidelines to follow: http://uxguide.dotnetnuke.com/ Build ‘view’ view [Breakout: student do 30 minutes of coding on their own] Build ‘settings’ view together and discuss PortalSettingsBase Error handling: DotNetNuke.Services.Exceptions Discuss build process and dnn manifest: versions, scripts, moduledefinitions, license/releasenotes Test package with evs.dotnetnuke.com

  3. IIS Setup and DNN Installation Unzip DNN Install package to folder on harddrive (give full permissions to folder to yourself and Network Service) Create empty database Create IIS application and pool. Add host header: dnndev.me, port 80 Browse site, should redirect to /Install.aspx Follow installation instructions

  4. Install Module Development Template Download from christoctemplate.codeplex.com DNN7 DAL2 vsix Double click the vsix installer to install in VS2012 Older versions, copy zip file to My Documents\Visual Studio 20XX\Templates\ProjectTemplates\Visual C#\

  5. Create Module Project Open VS2012, click New Project Name it RestaurantMenu Browse to [DNN7 Install Root]\DesktopModules\ Select DotNetNuke 7 C#(or VB) DAL2 Compiled Module Uncheck ‘Create directory for solution’

  6. Build in Release mode Should compile and initiate Build Scripts References: DotNetNuke.dll (core) DotNetNuke.Web.Client (ClientResourceManager) DotNetNuke.Web.Utility (ClientAPI, BrowserCaps)

  7. Register Module In DNN Using Package /install should have 2 packages: RestaurantMenu_01.00.00_Source and RestaurantMenu_01.00.00_Install Browse to DNN and install Source package

  8. The Components of a Module Module controls: view, edit, settings PortalModuleBase, ModuleSettingsBase IActionable DNN Controller: ISearchable, IUpgradeable, IPortable

  9. Database scripts 00.00.01.SqlDataProvider, Uninstall.SqlDataProvider What is this? {databaseOwner}{objectQualifier}

  10. DAL2 Model DotNetNuke.ComponentModel.DataAnnotations Use [ColumnName("Desc")] to enable different column name than model attribute Use [IgnoreColumn] to have computed attributes in Model that don’t save to database

  11. DAL2 Controller (Model Repository) I like to use the name *Repository Using DotNetNuke.Data Create, Delete, Update, Get

  12. Debugging our Module Build in debug mode Attach to w3wp process for IIS Attach to iisexpress process for IISExpress

  13. The ‘Edit’ View Allows admin users to add or update the menu items Uses DnnFilePicker to upload a picture Uses dnn Label control and dnnFormItem class for consistent form UI

  14. ClientResourceManager API RegisterStyleSheet(), RegisterScript()

  15. UI Guidelines http://uxguide.dotnetnuke.com/ Helps merge your module’s UI into the DNN UI to make it consistent Tabs, Tooltips, Alerts, Confirms, etc

  16. The ‘View’ view View type control that users without edit permissions can use Use ClientResourceManager to register css or scripts Implement IActionable to add the Edit to the context menu

  17. The ‘Settings’ view Implements ModuleSettingsBase LoadSettings() to recall settings UpdateSettings() to save settings changes Settings[“name”] associative array of settings for the current module.

  18. Error Handling Use DotNetNuke.Services.Exceptions Exceptions.ProcessModuleLoadException() in Module events Exceptions.LogException(ex) to log generic exception in your components

  19. Packaging (DNN Manifest) dependency type="CoreVersion” is the minimum version DNN your module is build from component type="ResourceFile“ contains all module files besides the assembly and SQL files Module definition: 2 control types: view, edit (settings is considered a special edit type)

  20. Test Install Package http://evs.dotnetnuke.com/

  21. Thanks to all our Generous Sponsor!

More Related