Dnn module development series (2) -- Build a module development project

Source: Internet
Author: User
Tags windows 5 dnn dotnetnuke
Create a module development project

The dnn module can be developed in two development environments:
1. Create a module development project under the entire dnn solution.
Advantage: You can easily reference the dnn component, refer to the implementation methods of other modules, you can view the definition of this method in dnn at any time through the "go to definition" operation, debugging is easier.
Disadvantage: slow speed. It takes a lot of time to open and compile a project.
2. Create a module solution in a separate way.
The advantages and disadvantages are exactly the same as those of the first one, but the speed in actual development is the key. Next I will talk about some of my experiences in establishing a module development solution in a separate way.

To establish a separate solution for module development, three problems need to be solved:
1. Where can I build a solution to help develop and test it?
2. How can I reference the original DLL and add the generated DLL to that directory?
3. How to debug it?

To do things well, you must first sharpen your weapon. First, we should prepare the following tools for the dnn module:
Dnn project templates: a functional plug-in provided by dnnjungle under vs. NET 2003. After installation, you can create a dnn project and some items used in the dnn directly in the vs environment.
Codesmith templates: A group of business logic layers that generate dnn modulesCodeAnd data access layer code used, codesmith code generation template.
Codesmith: the code generation tool, combined with the above modules, can greatly speed up code writing. (Http://www.codesmithtools.com /)
Related urls: http://dnnjungle.vmasanas.net/Development/Templates/tabid/28/Default.aspx

After all the above tools are installed, we can start the development of our modules. This module uses the Vs. NET 2003 Development Environment and dnn3.3.3 as the platform. The database uses the SQL Server database.

1. Create a dnn module presentation layer project. Run vs to create a dnn module development project. If, after you have installed dnn project templates, when creating a new project, two new projects, Visual Basic Project for dotnetnuke 3 and Visual C # project for dotnetnuke 3, are displayed at the project type. Here, I chose VB. NET as the development language. In fact, the dnn module can be developed using C. Select the dnn module template, set the project name to article, and select dnn as the project location.ProgramThe development topmodules directory in the folder to facilitate development and test. For example:

2. Create a data access layer project of the dnn module. Click Add new project and select dnn sqldataprovider Dal. The project name is article. Project location: topmodules \ article \ providers \ dataproviders. For example:

3. Set the dnn module presentation layer project properties to add references. First, add a reference to the dotnetnuke. dll component in the bin directory of the dnn program. Project properties do not need to be modified. The default setting is enough. When this project is enabled, some dnn namespaces are imported by default, So that you no longer need to reference these namespaces in each file. But laterArticleI will introduce the functions of these namespaces, that is, common functions.

4. Set the data access layer project attribute of the dnn module to add references. First, add references to the dotnetnuke. dll and Microsoft. applicationblocks. Data. dll components under the bin directory of the dnn program, and add references to the project of the presentation layer. Second, set this to the startup project. Set the project generation path to the bin directory of the dnn program. In this way, debugging can be performed in a timely manner after each compilation.

5. Compile the program. At present, you can compile the program. We will re-compile it later.

Note: The modules developed under dnn3.3.x can be used on dnn4.3.x.

Let's take a look at the development projects we have created, such:

mycompany. article project
app_localresources: Language Pack folder, which stores resource files with the same name as the user control
components: business logic code folder
articlecontroller. VB: business logic, which maps objects and relationships, that is, converting business entities to databases.
articleinfo. VB: Business Entity object
dataprovider. VB: supports multi-database access providers, which is equivalent to one or more database access interfaces
documentation: You can put some development documents and user manuals (if the installation package is not required, exclude it from the project)
Installation: You can use the generated installation package as a backup. You need to exclude it from the project before creating the installation package
providers: put some module-related providers, currently only da Taproviders: if you have other services that require compatibility, you can write other providers. For example, the document module will need to use charts to display the document display information in the future. There are many chart components available on the Internet, so you can write a chartprovider to provide a unified interface for access. Then write the provider implementation of the corresponding chart components, such as zedgraphprovider and webchartprovider. In this way, you can set in Web. config to be flexible and compatible with multiple chart components. The provider mode is a very broad application design concept in dnn. It can be said that it is a highlight of dnn.
Article. ascx: Used as the article list display control
articleedit. ascx: Used as the new/edit control of the document
articleshow. ascx: not available yet. Create it as an article display control later
icon_article_32px.gif: module icon
module.css: style used by the module
Settings. ascx: controls the page size of the document list.

Mycompany. Article. sqldataprovider Project
01.00.00.sqldataprovider Module database object creation script
Sqldataprovider. vb SQL Server database access implementation class
Uninstall. sqldataprovider Module

Debug program

There is an article detailed introduction: http://www.cnblogs.com/leeichang/archive/2004/11/16/64418.html
Generally, it is convenient, fast, and easy to use to debug programs by appending processes. The article has already been very well described. I will not talk about it much, but you should note that by default, Asp. net Process (for IIS 2000 and IIS 5.0 on Windows 5.1 and Windows XP are aspnet_wp.exe, for IIS 6 on Windows Server 2003 is w3wp.exe) as the ASPNET process. Therefore, to debug it, you must have the administrator privilege for the computer running ASP. NET.

After the dnn module project is initially established, we need to add the module to dnn to check whether the module can be properly added and run, laying a solid foundation for the next development. In the article "dnn module development series (3) -- add module definition in dnn", I will introduce in detail how to add a module in dnn.

Series Article Navigation:
Dnn module development series (1) -- Analysis and Design
Dnn module development series (2) -- Build a module development project
Dnn module development series (3) -- add module definitions in dnn

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.