This project is read-only.

Duplicate Parts

Topics: Writing modules
Jul 21, 2011 at 6:52 AM

I have run into an interesting problem. I had written a module with my own ContactPart and ContactPartRecord in my own name space. Then I proceded to load a third part Contact module with the same part name (which I was unaware of) which effectively disabled my Part from working. Seems this may be an endemic problem as more modules are built and shared...

Any thoughts on a workaround/solution (apart from the obvious of reaming my parts or making them quite explicit to guarantee uniqueness)?

Jul 26, 2011 at 1:32 AM

Well, why would you enable two contact modules? If there is a legitimate scenario for that, then they are probably not exactly the same concept, right? So they should probably have more specific names.

There are essentially two ways you can handle name conflicts: namespace everything (and impair usability doing so, that's what Java and .NET do, pretty much), or accept that there may be conflicts (that's what jQuery does). Sorry, Orchard is doing #2 :)

Jul 26, 2011 at 1:40 AM

I agree we wouldn't normally want two contact modules, or other module pairs that do the same thing. However in a global market where unknown users publish modules to be shared and installed there is plenty of scope for conflicting names even with disparate modules e.g. Booking or Product could crop up as named parts in modules that did very different things.

I accept Orchard is doing option #2 though the data being persisted is cleary using option #1 prefixing the table names with namespace. Maybe worth considering uniqueness across parts from different modules.

Jul 26, 2011 at 1:45 AM

Yes, you are absolutely right that persistence is enforcing uniqueness (largely because this is not exposed to the end user, so we can afford it). Still, it would be a major inconvenience to have to namespace part names everywhere. If there is a strategic fix that could be applied to reduce the friction here, it would be worth considering though. Would you mind filing a bug to track this?

Jul 26, 2011 at 1:56 AM

Happy to. Have created Issue #18034 Duplicate Parts. Cheers.