DNN Blog

Jul 19

Posted by: Charles Nurse
7/19/2006  RssIcon

I have now been working with DotNetNuke 4.x for nearly a year (if you include the development time with beta versions of VS2005), and I thought that it would be useful to discus the many options for developing modules.

There has been much debate in the ASP.NET developer community at large, since the release of VS2005 (Visual Studio 2005) and VWD (Visual Web Developer), concerning the new development paradigm for Websites introduced in VS2005/VWD.  As a result of demands from developers, Microsoft has recently added an add-on project type - Web Application Project or WAP.

Concurrent, with that debate, DotNetNuke Module Developers have debated, how they should their Modules.  In this Blog, I hope to give you an idea of the various methods available.

1. App_Code or Dynamic Compilation

The first methodology is the methodology used in the DNN 4.x Starter Kits.  This methodology basically extends the core Website project.  Modules are developed by placing the user controls (and other content files in the DesktopModules/[ModuleName] folder, and by placing the code files (Controller & Info classes and DataProvider classes) in the App_Code/[ModuleName] folder.

The advantages of this method are:
  • Inexpensive - this methodology is supported by VWD, which is a free download.  At present this is the only development methodology supported by VWD.
  • Simplicity, Ease of Use
  • Speed (RAD), the dynamic compilation means that changes can be made quickly to any code file and the website just needs to be refreshed - no need to build as the code is dynamically compiled.
  • As of 4.3.3 there is Increased support within the DotNetNuke core for this methodology
    • The Starter Kit can be used to create the Module files as a start in development
    • The Module Definitions module in the Host menu now allows a Dynamic Module to be "packaged" for release
The disadvantages of this method are:
  • IP - this methodology exposes all the Intellectual Property, so is not really feasible for commercial developers
  • Versioning - there is no single monolithic assembly for a Module so this provides a challenge for version control.

2. App_Code and PreCompile

VS2005 provides a Precompilation option.  This feature is not available in VWD - although it can be carried out using the command-line aspnet_compiler (available in the .NET SDK).

This option, from a development perspective, is much the same as the previous option.  However, this option does overcome both the disadvantages mentioned above.

There are two ways this can be done:
  1. Precompile the whole site (this is option is really only for those developers that are using DNN as a framework for a separate product, as all the code (core and modules) are precompiled into one or more assemblies.
  2. Precompile just the module.  While precompilation, by defination builds the whole site, with the appropriate settings it is possible to identify the assemblies that are part of your module and package them as a module package, for distribution

3. Web Application Projects (WAP)

This approach which has been developed by Bert Corderman and Vladan Strigo so I won't go into too much detail here.

This approach uses the new Web Application Project add-in for Visual Studio (not supported by VWD).  It follows fairly closely the approach used in DotNetNuke 3.x.  To fully utilize this approach developers must be prepared (at the moment) to do some manual post build and packaging tasks, although Bert and Vladan are working on ways to minise this through the use of MSBuild scripts and Web Deployment Projects (WDP).

At this time, I would catagegorize these approaches as promising, but not for novice developers.

They do satisfy the need for IP protection and version control, but they do lose somewhat the speed and ease-of-use that the first methodology offers.

We have been working with both Bert and Vladan to make sure that the DotNetNuke core can provide tools for this approach.

4. Hybrid Approach using Class Libraries

This approach is a variation of the first methodology, and is an approach that I have developed for my own personal modules.

The big difference between this approach and the first approach is that the code files (Info, Controller, Dataprovider etc) are in a Class Library, rather than in App_Code.

It overcomes (to some extent) the disadvantages of the dynamic compile approach in that the Business Layer and Data Layer IP is protected, and version control is supported.

The code files for the user controls are still left in the website and so the advantages/disadvantages of the dynamic compile methodology still exist for this approach.

In one module I am developing, I have however, taken this approach to the extreme, as the only IP (other than HTML layout for templating) in the website is the following:

namespace MyNamespace
{
    public partial class MyModule: MyModuleBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
    }
}

Thats it.

The reason why this works is that everything is funnelled through the MyModuleBase class.

I will be blogging in the future on this particular Module, as it develops a number of new and intersting ideas.

Tags:
Categories:
Location: Blogs Parent Separator Charles Nurse

15 comment(s) so far...


Re: Module Development in DNN 4.x

This is very informative. Perhaps starting a thread is the way to go to add points of view and strategies other developers are using.

By hooligannes on   7/21/2006

Re: Module Development in DNN 4.x

Would it be possible to have DotNetNuke create a module "package" (a .zip file PA) that has a single assembly?

By AdefWebserver on   7/21/2006

Re: Module Development in DNN 4.x

Charles,

To correct you with one detail… I and Bert have developed each our own dev. approach... the only thing that ties our approaches together is that we both use WAP.


Also to quote you:
"…but they do lose somewhat the speed and ease-of-use that the first methodology offers…"

I do not agree about the speed, neither ease of use... I would say that these are some of the biggest advantages of my approach.

It's a very fast development environment (this I measure mostly by speed of debugging with my solution, general speed of opening/closing solution, etc…).

Ease of use as well, once you set it up (which when you know how to do it is not a problem either... or with the future templates should be much easier) it's much faster and pleasant than other dev. approaches you've mentioned.


Not to mention when you also employ the Deployment script – which gives you the possibility to package and deploy modules from Visual Studio – you get even greater ease of use and you eliminate one more tedious task.


Otherwise, I think your article is great and does a nice job of summing up the options developers have in DNN world today :)


Thanks,
Vladan Strigo

By vladan on   7/21/2006

Re: Module Development in DNN 4.x

Vladan - I appreciate your comments.

I didn't mean to imply that you were working together. Maybe I wasn't clear enough - thanks for the correction.

Also, having not had the opportunity to actually use your approach yet, I was basing my comments on the "perception" of the WAP approach. And my comments re Speed/Ease of Use were based on the ability of the dynamic compile method to not need a build step before testing.

Anyway, the real goal of this article was to emphasise the richness of the possible development enviroments, and there is no need for a "one-size-fits-all" solution.

By cnurse on   7/21/2006

Re: Module Development in DNN 4.x

Michael (Adef)

Short answer - it should be, as these actions are controlable by MSBuild, and MSBuild can be called by the .NET Runtime.

However, here I tend to agree with Vladan, that as modules are developed on a local machine, a better solution is probably to "provide" MSBuild scripts to accomplish this, through a custom Web Deployment Project.

By cnurse on   7/21/2006

Re: Module Development in DNN 4.x

I recently had to create 3 modules for a book chapter I am working on. Using the "packager" I was able to package up all three modules in 3 different packages in less than one minute. The packages was perfect and I was able to upload them immediately to another test portal. The ease and simplicity of this is amazing. I'm able to cut out 5 pages of explanation on transferring your module from development to production by showing this one simple step.

If that packager were able to create a .zip file that had a single assembly then I would suspect that the majority of people would use it.

By AdefWebserver on   8/10/2006

Re: Module Development in DNN 4.x

Michael,

It can... you have an WDP on my site which does this only with already single assmebly.

However the original WDP which you create for a project has this option (to merge assemblies) even in it's settings (not to mention you can write it yourself in the project file) via ILMerge tool - very neet.


Vladan Strigo

By vladan on   8/10/2006

Re: Module Development in DNN 4.x

"Precompile just the module" - is there any where with instructions on how to do precompile a module using the aspnet_compiler?

By palmernet on   8/10/2006

Re: Module Development in DNN 4.x

I also would like to know if there are instructions on how to 'precompile just the module'.

I am currently using the hybrid approach, with my info classes and controllers in a single compiled file. And, I would like to know how to protect my IP.

I've been looking round the web for answers, but I have found many techniques, but nothing that offers all the nice things I would like - like in-line debugging, versioning and simple 'compile-to-production' methods. I'm using VS2005 and C#.
Are there any other good resources I should be looking at??

Thanks
- Dave

By davenorman on   11/21/2006

Re: Module Development in DNN 4.x

"Precompile just the module", using aspnet_compiler. Find a simple sample here:

http://www.effority.net/Forum/tabid/66/mid/386/threadid/131/scope/posts/Default.aspx

By bbhermann on   11/29/2006

Re: Module Development in DNN 4.x

I also would like to know if there are instructions on how to 'precompile just the module'.

By howard23 on   2/3/2007

Re: Module Development in DNN 4.x

I've tried precompiling DNN 4.4.1 using a web deployment project in VS2005. I run into problems with the App_GlobalResources folder being hardcoded into the solution.

Can you offer any solutions?

By hezcaby on   3/1/2007

Re: Module Development in DNN 4.x

hi i want to download the dotnetnuke S/W

By Ratnesh on   5/27/2007

Re: Module Development in DNN 4.x

I also would like to know if there are instructions on how to 'Consume my Webservice' .

My webservice is writen in C# all the logic is in the webservice now i want to make verious modul of presentation layer with dotnetnuke is there any way to do it.
I also see the tutorial of in this side("http://www.codeproject.com/aspnet/Creating_A_DNNModule.asp") but i couldnot success

Are there any other good resources I should be looking at??

By biplabsaha_03 on   8/7/2007

Re: Module Development in DNN 4.x

How do i create a module user dotnetnuke dynamic module?

is there any document explaining step by step process to create a module, integrate it with DNN 4.X

By lkumar on   3/7/2008
Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft .NET. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates Snowcovered.com where users purchase third party apps for the platform.