Upgrade to DD4T 2.0 – Content Delivery (CD)

In the process of upgrading your existing DD4T  based implementation to latest DD4T 2.0 based implementation, the major effort is required in the Content Delivery side.

You would typically be following below process for upgrading your code/implementation to the DD4T 2.0:

Reference Fixes:

Typically, you would be doing following:

  • Removes all references to DD4T 1.31 dlls from each project in your website solution
  • Download and Install DD4T packages using NuGet Manager – What all packages you may need to install depends on your specific implementation requirement, however, you would mostly be downloading and installing following packages:
    • DD4T.MVC5
    • DD4T.Model
    • DD4T.Core
    • DD4T.Providers.SDLTridion2013 or DD4T.Providers.SDLTridion2013sp1 or DD4T.Providers.SDLTridion2011
    • DD4T.DI.Unity or DD4T.DI.Ninject or DD4T.DI.Autofac – In case you are using a DI mechanism provided by Unity or Ninject or Autofac respectively
  • Ensure, all necessary projects now have a reference to these newly downloaded DD4T 2.0.x.x version dlls

Compiling the Solution:

There may be a variety of compile time errors after changing the references to the new DD4T dlls. The magnitude of compile errors and their fixes entirely depends on the implemented code, usage & customization/extending/overriding of DD4T classes/methods and cleanliness of the code. You can get an idea of changes and challenges you might face by referring the below list of typical compile issues I have faced and required a resolution in the code: (The below list may be different in your implementation)

  • Change all references of D4T.ContentModel.Logging to  DD4T.ContentModel.Contracts.Logging
  • Change all references of D4T.ContentModel.Logging.ILogWrapper to DD4T.ContentModel.Contracts.Logging.ILoggers
  • Change all references of DD4T.Utils.LoggerService to DD4T.Utils.Logger
  • Change all references of DD4T.Providers.SDLTridion2013 to DD4T.Providers.SDLTridion2013sp1
  • Change all method calls of GetView(ComponentPresentation) to View(GetViewName(ComponentPresentation))
  • Need to re-implement IPage interface for newly added method – IDictionary<string, IFieldSet> ExtensionData
  • A variety of DD4T classes now does not have a parameter-less constructor, additionally, most DD4T classes have changes in the constructure signature – This requires a change in all those classes in the implementation inheriting from these DD4T classes.
  • PageFactory now does not have a parameter-less constructor and also have its constructor accepting additional parameters – This means if there is any customization/extending of this class, you need to appropriately make changes in that class to support the updated constructor
  • TridionControllerBase now does not have a parameter-less constructor and also have its constructor accepting additional parameters – This means if there is any customization/extending of this class, you need to appropriately make changes in that class to support the updated constructor
  • Need to change all references to DefaultComponentPresentationRenderer as there is no parameter-less constructor

Run-time Fixes

After all compile errors are resolved, you may come across a variety of run-time errors which also need to be fixed. These run-time errors entirely depends on specific implementations. Few major changes, I experienced while upgrading are as below:

  • All references to IComponentProvider must be changed to IComponentPresentationProvider. The IComponentProvider is marked as deprecated in DD4T2.0 so you will not get any compile time error, but actually, all the methods in IComponentProvider are throwing NotImplemented exception.
  • Change of IComponentProvider to IComponentPresentationProvider means we also need to change any reference of IComponentFactory to IComponentPresentationFactory
  • Above changes suggests, all method calls to GetComponent may need to be changed to GetComponentPresentation. 
  • Further this means, TryGetComponent would be changed to TryGetComponentPresentation – Please note the parameters order is changed for these two method
  • Following new dependencies must be declared for your DI module in use (In my case it was Windsor, so a bit of different process):
    • IProvidersCommonServices
    • IDD4TConfiguration
    • IFactoryCommonServices
    • IComponentPresentationFactory
    • IComponentPresentationProvider
    • ILinkResolver

There may more or less changes during the run time as well as compile time depending on your specific implementation and code.

BTW – Not to mention the great help from Harald Hoffelinck in identifying and resolving some of these critical issues.

NEXT – Upgrade to DD4T 2.0 – Content Manager (CM)

Advertisements

Director at Content Bloom India having 12+ years of experience in Software Development Life Cycle using AGILE, Iterative and RUP approaches. Experience in following: - CMS packages: SDL Tridion, Adobe Experience Manager (AEM), Sitecore, Umbraco, Kentico, and Alfresco - Search Engines: SOLR, AWS Cloud Search, Elastic Search - .NET Technologies: .NET & .NET CE Framework, ASP.NET, ASP.NET MVC, WCF, WinForms - Mobile Development: Android Native App, Windows Mobile App - Database: MS-SQL Server, MySQL - Program Management: JIRA, MS-Project, Trello - Design Tools: MS-Visio, StarUML - Infrastructure: Linux, Windows Server, AWS Have decent knowledge about Core Java, Spring MVC Instrumental in Application Architecture, Designing (HLD & LLD), Coding and deployment .NET applications (Web, Desktop, Mobile). Experience in following domain: - Digital Media & eCommerce - Travel & Hospitality - Aviation Industry - Education - Insurance - Automation - Automobile - Railways Education: Bachelor Degree in Computer Engineering and Post Graduate Diploma in Business Administration with specialization in Marketing

Tagged with: , ,
Posted in SDL Tridion
One comment on “Upgrade to DD4T 2.0 – Content Delivery (CD)
  1. […] NEXT – Upgrade to DD4T 2.0 – Content Delivery (CD) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: