Skip to main content
Home  ›  Blog

The Future of DNN Speaks Razor - #1 You have to migrate now!

If you're an old-school DNN developer you're used to using ASP.net Forms - and you've developed tricks and techniques to compensate for various issues like clean SEO-HTML, JavaScript-Control-IDs and more. You've also implemented 3rd party controls (like a Telerik Grid) and spent hours of your time trying to compensate for certain shortcomings. Well, it turns out that this is not necessary any more - but most DNN-dudes don't realize this yet. Because the future is in absolute HTML control - using Razor. Let me tell you why, and how to get started.

This is part 1 of the Series The Future of DNN Speaks Razor. In this post I'll explain why you have to migrate now.

You have to migrate to Razor now, because…

  1. …Microsoft is officially phasing out ASP.net WebForms and WebControls
  2. …this is forcing DNN to also migrate towards Razor (see the Roadmap)

  3. ...this means cshtml! and cshtml means Razor.
  4. …so if you develop something that should still work in the near future, you have to learn Razor now! 

You may believe that DNN will provide backward compatibility - and they might. But I hope they won't. Any system as mature as DNN also has loads of bad features that it picked up along the way - for example widgets - which are very expensive because they cause bugs, have to be supported, but are barely used at all. So here is an opportunity to say "We have very new stuff, and it's so different, that when you use it, you also have to adhere to modern standards". I hope they will do this - and the label "platform trimming" might just include this.

So: Yes, you have to learn Razor. ASAP. No kidding.

What Will be Developed in Razor?

  1. Menu-templates - this is already possible today with the DDR-Menu
  2. Skins - once DNN fully supports Razor, you will be able to write Razor skins
  3. Skin helpers - like tags which insert/handle a language changer - this can already be done today similar to how the DDR-Menu does it
  4. Module Output - I'm guessing that only Razor-style modules will work within a Razor skin since supporting WebControls inside a Razor would require an architecture defeating Razors advantages, and because it's a great opportunity to clean up.
  5. Admin-UIs for configuring your modules - will probably be Razor + WebAPI + AngularJS (my recommendation)
  6. Edit-UIs for entering data - also probably Razor + WebAPI + AngularJS (my recommendation)
  7. Customizable output templates which the web designer can adapt

This must be a joke, right?

Nope, this is serious. We (2sic) moved almost all our DNN-programming (except for skinning) to Razor about 2 years ago - and it's a huge blessing! Imagine things like:

  1. Module installs and updates which don't require DLLs, so no Server restarts…
  2. …and no risk that DNN will stop working. The template might fail, but not DNN
  3. If you had installed a third-party gallery and the customer needs this trivial change…you're usually forced to do loads of work including buying the module in source-edition, figuring out what approach that person used, extend the module, compile, install - and loose upgrade-compatibility…since we've moved to Razor-based Apps, this cycle is reduced to almost nothing.
  4. Since Razor is output-focused, we can easily create an alternate output-template for each portal (assuming your module supports this - which it will have to)
  5. The code is much cleaner, because Razor forces you to separate your concerns a bit more.
  6. The code is easy to read - and usually complete (not part of it hidden in a code-behind just because the programmer didn't know data-binding) 

Here an example so you see how easy it is to read Razor-Code:

My Next Razor Posts

So Each of the Following Days, I'll release another post for this topic. This will be covered:

  1. You Have to Migrate Now! (this post)
  2. Just What is Razor?
  3. The Death of ASP.net WebForms
  4. The Death of ASP.net MVC
  5. ASP.net WebAPI is great for Apps…but not for Content
  6. Which technology to use for which part of the solution
  7. Getting started with Razor…

With love from Switzerland
Daniel

PS: Want to get started before the entire Razor-series is out? For the impatient, try the DNN-Razor Host Module and watch this video  or try packaged code apps by installing 2sxc and some of the Razor Apps like the Razor Basic TutorialsList-Tutorials or the SQL and Peta-Poco Tutorials

 



Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 800 DNN projects since 1999. He is also chief architect of 2sxc (see github), an open source module for creating attractive content and DNN Apps.

Read more posts by Daniel Mettler