Refactoring entire project architecture


Hi all,


I'm currently trying to refactor an existing EPiServer installation. There is a number of issues with current setup, eg. existing project has everything under same csproj and same namespace (project is a year old) so there is quite significant number of records. Also its a spagheti code with lack of tiers. (views calling db etc.).


I have successfully refactored the code however obviously nothing loads anymore due old namespaces still being in the database? Has anyone ever conducted similar projects? Is there a tool that would resolve issues such as this? Is there a set of best practises for structuring/architecting EPiServer project (maybe I'm missing something and this is project actually follows some set of Best Practises for EpiServer!)


Kind regards,


Dec 09, 2013 3:24

There are a couple of things that will cause problems if you change their namespace and or assembly, typically this is for page types, custom properties and dynamic data store stuff. It's however possible to get around this and update the database.

When it comes to structuring EPiServer project it's a little different from project to project and the EPiServer partner company implementing it. In my projects I try to follow a basic ASP.NET convention together with some EPiServer conventions I've picked up over the years, the main thing though is that I try to keep things as simple as possible. Maybe you could describe a little how your current project is setup and what you don't like with it?

Where are you having problems with the refactoring?


Dec 09, 2013 10:43

Hi Frederik, 

We have a project called Project.Web (which is webforms) project that contains pretty much everything. (repositories, services, templates, views, dynamic contents, page types). 

I have created a new project (Project.Data) to contain all building blocks (such as Page types, repositories, services). Everything seems to be interconnected with many dependencies so its been a bit of a uphill battle to separate concerns.

I have managed to write powershell that compares all files in two given folders for namespaces + class name and generates migration CSV file which then I consume in my custom made (very primitive) console application that updates all tables in database.

So far so good. I have had issues with stored procedures and views that get created for dynamic data stores - had to rename those manually.

Can you give an example of project structure that would mix with some EPIServer best practises? 




Dec 09, 2013 23:06

How large is this project? In many cases one web project is fine. It all depends on the size and your team preferences. In some cases I split it into multiple projects where I have a separate Models projects for my models (BlockTypes, PageTypes, EditorModels, ViewModels, PersistentModels etc), then I maybe have an Infrastructure project (typically stuff like RouteConfig, DependencyInjection, Email, Bundling/minification etc), and then depending maybe a project for more Core parts and DataAccess etc.

When it comes to DDS see this post: Dynamic Data Store and Store Remapping.


Dec 10, 2013 9:48

Project is quite large. So far pages are loading fine and I dont see any immediate issues. So fingers crossed. Issue with DDS was an issue was actually due to migration application not doing its job properly. Its fixed and so far its working ok.

I'll probably put migration scripts and console app on github or something so others can benfit, however I hope that nobody has to go through it all!

Dec 10, 2013 11:13
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.