DotNetNuke (DNN) 2.x Module Architecture, Part I
| In this article we go over the architecture of a DNN 2.x module, specifically the Survey module example included within the DotNetNuke distribution. In part one, we cover setting up a development project, and the user interface for our module. |
|
If you're not familiar with DotNetNuke, be sure you visit http://www.dotnetnuke.com to learn more about this fast growing open source portal that you can use and develop against absolutely free. DotNetNuke (DNN) has been out now for a little over a year and has really seen a tremendous amount of growth. The community is a very active and large community, which can easily be demonstrated by viewing the activity in the ASP.Net forums. In this article we will cover module creation for DotNetNuke, and specifically look at the Data Provider Model of DNN 2.x. We will not get into a step by procedural method of developing modules, but rather provide you with an overview of the architecture and starting point for developing your own custom modules for DNN. What Are Modules? Modules provide developers with the ability to extend the functionality of DotNetNuke. DotNetNuke provides a pluggable framework that can be expanded by the development of modules. A module container is provided by DotNetNuke to host a custom module. Modules can be developed in any .NET language, even though DNN is developed in VB.NET, a C# developer can still create a module that plugs into the core framework provided by DNN. This pluggable framework is accomplished by creating compiled private assemblies that expose and utilize interfaces specific to DNN. Once you compile the assembly, then just create a UI in the form of ascx files that allow your user to interact with your module. Module Containers Module containers provide several features for you as a developer. Besides being your way of interfacing with the DNN core framework, module containers also provide the following:
Configuring Your Development Environment Now that we covered what modules actually are, lets go on and create a development project for our module. There are various methods for creating modules for DNN, but we prefer to configure a separate project for module creation and then compile the assemblies within the DNN bin folder. The following procedure provides a method for configuring a portal module project in Visual Studio.NET.
That's it for the base module assembly project. Now if you want to add a data provider assembly to your project you would follow the same procedure above except name your project CompanyName.ModuleName.SQLDataProvider (or Access depending on which database you're supporting). In addition to creating a reference to the DotNetNuke project, create a reference to your main module project and also the Microsoft.ApplicationBlocks.Data assembly. This is going to aid in the data abstraction. Once you're project is done, it should look like the following in the solution explorer in Visual Studio.NET:
Figure 1.1 Solution Explorer View Now let's first cover a little architecture for DNN. The following diagram is taken from the DotNetNuke documentation. This provides a look into how DNN is architected. First with the ascx controls which provide our user interface. The interface then communicates with the Business Logic Layer (BLL), as in the diagram this BLL is contained with the SurveyDB.vb class, and provides all data for our user interface. Below the BLL we have the Abstract Data Provider, we'll get more into this later, but this class provides an abstraction layer for our application. This provider is not database specific, rather our data provider class will provide methods that override the abstraction class and interaction with our specific database. The abstraction provider in this example is the DataProvider.vb class within the main survey module project. Below the abstraction layer we have our Data Access Layer, this class is specific to a vendor database and is unique based on what database we want our module to interact with. This class is the SQLDataProvider project as in the image above. Finally there is the Microsoft.ApplicationBlocks.Data which provides functions for our specific database interaction, and frees a developer from having to write specific SQL Server code.
Figure 1.2 DotNetNuke Architecture Now that we covered project creation and architecture, let's get started writing some code. All code referenced in this article is the survey module example provided with DotNetNuke, so you can try it out for yourself. Create Your Controls First we need to create some controls for our user to interact with. In this example we have a Survey.ascx control, this control is the primary survey control that is public ally viewable for the user. The other controls are for managing the survey, these are the EditSurvey.ascx, and EditSurveyOptions.ascx controls.
http://www.wwwcoder.com/main/parentid/224/site/3008/68/default.aspx |
浙公网安备 33010602011771号