High-level question about module architecture

Topics: Writing modules
Sep 3, 2013 at 4:24 PM
Hello,

To cover several requirements, I have a need to implement a CMS, and I selected Orchard. I would like to explose here one of my complex needs, that hopefully might be covered by Orchard + custom module development.

Let me explain in a generic way... Let's say I manage a list of products in my company.... Each product is managed across different internal IT systems (all related data stored in SQL Server DB). For instance, I might have:
  • A SQL DB containing stock status for all products
  • Another SQL DB containing product description for all products
  • etc.
Keeping my request as generic, I could potentially have N SQL DB, each one containing a subset of information about all products.

My question / needs is to understand if it is possible to use Orchard as modular reporting platform.

Here is my idea about a potential architecture, please let me know if it would work / be the best approach:
  • A product would be defined as a new content type
  • Each product will be inserted as a new content item
  • For each external system, a dedicated module would be built providing dedicated content part
  • For each external system, a subset of the information would be stored in the Orchard DB table (for easy search, etc.). Remaining part of the information would be directly retrieved for display by SQL query to the external DB.
  • I would keep a generic / modular approach. If there is a new external DB that I would like to query for reporting purpose, I would develoop a dedicated module / content part added to the product content type.
Questions:
  1. Does this approach make sense given the existing Orchard architecture ?
  2. As the list of product changes on a daily basis, I would need to update the Orchard DB to programmaticaly add/remove product (content item), and update related primary keys to all external DB --> Is it supported to modify the Orchard DB for this purpose ? Is it documented ?
I know my question is quite generic, I hope it makes sense :)

Regards.
Coordinator
Sep 3, 2013 at 4:30 PM
  1. Yes, I've seen similar approaches implemented a couple of times, although synchronizing contents with external databases is never easy. If you can avoid products being content items, it's actually better as you can keep that data outside and avoid expensive synchronization. Only do it if you have really good reasons for products being content items. It won't be easy.
  2. I don't see why not, you can do pretty much anything using ContentManager and other data access APIs, but I doubt you'll find much documentation to help you there.
Sep 3, 2013 at 6:03 PM
Thanks Bertrand for your quick answer,

About good reasons (or not) to have product defined as content items. My primary idea was to sync product list + a few related attributes to be able to easily leverage some interesting features of Orchard, typically projection/query or search.

Would it be possible without having 1 product = 1 content item ?

Regards.
Coordinator
Sep 4, 2013 at 12:06 AM
No. Well, maybe but in either case it won't be easy.