Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


Step One Complete: ASP.NET Core Dependency Injection in DNN

In a recent blog post I provided a bit of a status update to the community on the DNN Platform plans for a migration to .NET Core. In that post, I outlined a number of the key initiatives and the steps that were being taken to accomplish the goals. In this post, I can proudly proclaim that the DNN Community has delivered, and DNN 9.4.0 and later will have ASP.NET Core Dependency Injection support for all extension development types. This was made possible by a great contribution from Andrew Hoefling in collaboration with the entire Technology Advisory Group (TAG). In my opinion, this contribution is one of the biggest keystones to progressing forward.

An Excellent Example in Collaboration

Before I dive into the details of what this means, I wanted to take a moment to step back and highlight the amazing collaboration and communication that was exhibited in this pull request. With the community being a group of individuals volunteering all time given, myself included, efficient communication is key to help things move quickly. This contribution is a great example of how quickly things can be processed, even large contributions if they are documented well.

Andrew's initial issue was created to fix an issue within the DNN pipeline. The community was able to help him understand the history and help talk through some implementation details. Once the final pull request came in it included examples for usage, limitations and other information. For the reviewers, this made testing fantastic, but also makes it easier for us to include this in release notes. For this, I applaud Andrew and encourage us all to follow a similar standard of documentation as we continue to make large shifts in the platform.

Dependency Injection, So What?

Moving past the logistics of the change, your biggest question might be. Why do you care about Dependency Injection so much? Or, what the heck is dependency injection? If you are asking either of these or similar questions, you are not alone. For those that are non-developers, sadly, this change isn't something that can be easily witnessed or understood. However, I'll try to break this down a bit into some common themes that should be understandable by all.

Why Do We Care?

Dependency injection is incredibly important to the future of development within DNN for many reasons;

De-Coupling

The DNN Platform has been in active development for more than 15 years. During this time, hundreds of developers have contributed to the source code, workarounds for old system limitations have been introduced, and many anti-patterns have introduced some code that is less than helpful. With all of this history, we often find sections of the site that are tightly coupled, or dependent upon each other. In some cases, we have Circular Dependencies, which are the absolute worst thing to deal with.

A benefit already included with Andrew's contribution is what appears to be a major performance improvement to the rendering of MVC modules by "fixing" one of the circular dependencies. For the developer types, this change removed a reflection call that was called (N) times per module, per page. For module heavy, MVC sites, the performance gains should be sizable.

Better Support For Unit Testing

By allowing dependencies to be injected, we open the world up for developers to better unit test their solutions. The current shift in software development places a strong emphasis on unit testing and code coverage, which, without support for Dependency Injection in DNN has been very hard to accomplish.

There is still a long way to go in this area; however, the first step was to be able to inject dependencies. The next step will be to update the DNN API's to get rid of static methods and to better support injection at the framework level. Work that will be continuing for a while.

Adherence to Current Standards

There was an existing pattern within DNN Platform, the Service Locator Pattern that allowed dependency injection to happen in the past. However, this was a limited implementation that did not properly follow industry best practices and introduced a learning curve for developers coming to the platform. With the adoption of the ASP.NET Core Dependency Injection library, all of the features will match the Microsoft documentation, lowering the adoption cost.

One could also argue that by supporting current standards we will be equipped to better acquire new talent to the community.

What is Dependency Injection

Thankfully, for the uninitiated Andrew has also taken it upon himself to properly document exactly what Dependency Injection is and how to use it in MVC, WebAPI/SPA, and WebForms modules. With these great posts, I'll defer to them for the proper answer to this question.

Recomendations to Developers

This new features opens the door to proper architecture with DNN Modules and solutions. I would strongly encourage developers to consider the adoption of these new practices as soon as they become available with 9.4.0. By properly using Dependency Injection, you can start to restructure legacy DNN Installations, which in the end will make the future transitions easier.

I also encourage everyone to test the 9.4.0 release heavily, there should be sizable performance improvements with these changes, however, continued real-world validation is imperative.

The future is bright, this is just one major success with many to follow.

Comments

Clint Patterson
Awesome work Andrew!
Clint Patterson Tuesday, May 21, 2019 5:33 PM (link)

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out