Some Challenges during Upgrading from DD4T1.2 to DD4T 2.x

Currently I am working for client who is upgrading from DD4T1.2 to DD4T 2.2. While working on I came across few issues. So, thought to share it with you all so that it will be easy for you all and help you in saving some time. Below are couple of issues in this blog. I will be sharing more in future blogs.

“ ’ComponentProvider’ does not implement interface member ‘IComponentPresentaionProvider.GetContent(string, string)’ ”.

This issue because we not implementing exact function that is there in the interface.

I could fix this by changing the function GetContent(string uri) to GetContent(string uri, string templateUri).

“ There is no argument given that corresponds to the required formal parameter ‘providersCommonServices’ of ‘BaseProvider.BaseProvider(IProvidersCommonServices)’ ”

This issue is popping up since appropriate base constructor is no called. It can be fixed by adding parameter to the ComponentProvider function as below.

“The name ‘configurationHelper’ does not exist in the current Context”

Since assembly reference is changed, ConfigurationHelper is not available. Here few steps to fix this issue.

  • Create an object instance as follows for DD4tConifguraion.
  • Since ‘SelectComponentByComponentTemplateId’ is deprecated, change it to ‘SelectComponentPresentationByComponentTemplateId’.
  • Similarly, since ‘SelectComponentByOutputFormat’ is deprecated, change it to ‘SelectComponentPresentationByOutputFormat’.

Below is the code snippet for reference.

Please feel free correct me if there are any mistake and also add any missing information.