Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to work with NopCommerce MVC as a team

We are currently looking at the newest version (2.60) of NopCommerce in MVC and we will be integrating it pretty soon…We’ve downloaded the Source Code and paid the 20$ for the User Guide documentation. The documentation is great! I mean…it is great in the sense that it explains how to deploy, install and how to work around the UI Frontend and Backend. This is great for an overall overview but what it lacks is the understanding of how to work with NopCommerce as a team. What are/is the best practices etc...

As an example (or parallel), if you decide to work with Dotnetnuke as a team, you usually work in the following fashion:

  • Each developer downloads/installs Dotnetnuke locally on their machine.
  • You also download/install Dotnetnuke on a dedicated server (let’s say dev-server).
  • As a developer, you work and create modules which you test locally within your Dotnetnuke installation.
  • Once it is done, you package your module (and any SQL scripts that comes with your module) into a zip file.
  • Once the package is ready, you upload/install that package on the dedicated server (dev-server).

This approach works great for Dotnetnuke and more importantly if you have a team of developers creating modules.

My question is how does a team work with NopCommerce MVC?

I’m assuming it is a bad idea to directly work within the source code in case your team decides to modify core elements/source which will make any upgrade to newer versions impossible (or break changes).

I’m not sure if my parallel to Dotnetnuke is a correct one…but would anyone have any idea (or help me clarify) how does a team work with NopCommerce MVC.

In addition, should the team only rely on creating plugins for NopCommerce and stay away from modifying the core or should this be irrelevant?

What about adding new objects in SQL (or modifying existing ones) should we prefix our objects in case an eventual NopCommerce MVC upgrade creates similar objects and/or overwrites them?

Thank you for helping me shed some light on this.

Sincerely

Vince

like image 362
Vlince Avatar asked Aug 02 '12 12:08

Vlince


1 Answers

Plugins in NopCommerce are almost like modules in DNN. Depending on what you need to do, it sometimes is necessary to modify the core code.

What I've been doing for the Services is create a new class and inherit from the existing service, then override the function you want to change. Create a new DependencyRegistrar class and set your new service classes as the implementation for that particular interface. Also make sure the Order property is 1 so that your DR class is loaded after the stock one. Since you're inheriting from the core class, any functions you didn't override will be handled by the parent class. If I need to add a new function, I'm just modifying the interface, putting a stub in the stock class, and implementing it in my own.

Views in the Nop.Web project can be overridden by Themes. The Admin stuff and the Web Controllers get trickier. I'm just modifying those files directly.

The Core and Data classes can be done using partial classes to add your new fields.

In any case you will still need to merge changes with your solution when an update is released. My opinion is that you are better off writing clean, readable code now and bite the merge bullet when it comes.

I don't really worry about SQL scripts right now because I'm a single developer but maybe you add a folder for ALTER scripts and name them after the day they were created. Then each dev knows which scripts they need to run when they get latest.

like image 93
AndyMcKenna Avatar answered Sep 18 '22 17:09

AndyMcKenna