When you are getting a project that is based on the MVC and
want to migrate it to Sitecore Helix pattern then you can follow the below
steps.
Although each project has its own structure, I tried
to highlight a few common points that may be useful to convert an MVC app to
Helix structure:
- Ensure that you have upgraded your MVC app to the framework version compatible with helix VS project’s and checked that site is still working.
- Identify in your MVC project if there is any
external project’s dependency? If so then check if breaking the code in
multiple features will have any impact due to that external project’s
dependency?
e.g., in one of my projects, there was a DLL reference of an external project which was referring to log4Net, but when we moved it to the helix then Sitecore logging DLL's reference was using an upgraded version of the Log4Net due to which mismatch of the version caused the issue. So, we first upgraded the Log4Net version in the external the project’s git repository and then checked if the MVC site is still working with that dependency, luckily all was working fine and we were all set to have no dependency breaking for the external project.
Obviously, you can't identify all such kind of issue but try to cover the space as much as you can. - List down all the components of your MVC site, because each component of your website will be the feature in the helix.
- Start with migrating easy features e.g., select header, footer, CTA components first.
- Identify the code, model and views which mostly being used for that feature, don’t worry if it contains the code/model of other features, because once we have segregated our code feature-wise then at last we will identify the code mixed for other feature then it will be simple to shift that code to their original feature and can be refactored.
- Finally, always try that no feature is using the reference of other features. Better you use dependency diagram to easily check the dependencies.
- Merge your MVC web.config with Sitecore wwwroot web.config and move the <AppSetting> to <SitecoreSettings>.
NOTE: Always estimate the efforts
for the Sitecore side as well because MVC site has hardcoded content and you have
to move the content in CMS, and never confuse between 3-tier architecture with
helix because both are not equal.
For more collective information
you can use these helpful resources:
·
http://www.mtelligent.com/home/2017/10/13/best-practices-for-sitecore-helix-and-general-development
DISCLAIMER: As I mentioned in the
starting of the blog that each project has its own structure but I tried to
provide some common ways to make you move in the correct direction.

https://sitecorepeanuts.blogspot.com/2020/07/non-sitecore-mvc-to-sitecore-helix.html
ReplyDelete