Find a post...

DNN-Connect Blogs

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

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 600 DNN projects since 1999. He is also chief architect of 2sxc (2SexyContent - see forge), an open source module for creating attractive content and DNN Apps.

 

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 learned programming with the bible translation computer of his parents, deep in the jungles of Indonesia. Since he was only 12 years old at that time and the BIOS only had a version of BASICA, that's what got him started. With 16 he went back to Switzerland and learned German and basic city-survival skills. Equipped with this know-how he founded 2sic internet solutions in 1999 which was focused on web solutions on the Microsoft platform. After a few self-developed CMSs 2sic switched to DNN in 2003 and has been one of the largest partners (17 employees, 700+ projects) in Europe. Daniel is also the chief architect behind the open source 2sxc, a strong promoter of standardization (boostrap, patterns, AngularJS, checklists, etc.) and loves to eat anything - dead or alive. His motto: if the natives eat it, it game.
Comment(s)
Peter Donker
Peter Donker  "Microsoft is phasing out WebForms" is a bit sensationalist. It's being mothballed. No further effort will be devoted to it. It won't stop working. Much like ASP still works. I commend your effort to "sell us" onto Razor. But I have an issue with the alarmist tone. I don't like people screaming in my face that I "have to do this NOW". One thing I've learned over the years is that every year there's a new fad with Microsoft development. And every year we get bombarded with posts about how we should adopt it. Fine. Whatever you want. But "NOW"? No. Let's see the dust settle on some of these things.
· reply · 0 0 0

Hosting liberally provided by

Philipp Becker 6012 7
Geoff Barlow 547 4
DNN-Connect 431 6
Peter Donker 5060 30
Christopher Hammond 681 2
Olivier Jooris 419 1
Daniel Mettler 12009 88
Clint Patterson 1 1
Jos Richters 65 1
James Rosewell 327 2
Will Strohl 1546 27
Ernst Peter Tamminga 437 4
Barry Waluszko 2807 2
Declan Ward 453 1
Gifford Watkins 722 9
Torsten Weggen 2697 3