0

We're planning to develop a lightweight CRM (customers, orders, resources etc) application in WPF with Prism.v4. We already built a outlookbar-like usercontrol and use the microsoft ribbons. There exist additional regions, but these are the essential ones for this scenario.

Furthermore there exists an infrastructure dll with all the models, repositories, interfaces etc etc.

After some brainstorming we came up with the following fact:

The customermodule needs nothing to know about the ordersmodule (the ordersmodule knows the customer models). But we want the usercomfort to load all orders which belong to a specific customer. So in customer-detail-mode (customer ribbontab and customer outlookbar items are injected) we want a ribbonbutton to navigate from "customer detail" to "this customers orders".

The question is: how to achieve this without breaking the loose coupling?

Our approach: giving the customer-ribbontab a region for other modules interaction with customers. Because the ordermodule defenitively knows about the customer (based on the 1:n relation from our datamodel).

Thank you in advance

csteinmueller
  • 2,427
  • 1
  • 21
  • 32
  • I may be a bit tired today and I don't know if it's the thing you need, but you might to want to read up on [PRISM Navigation](http://msdn.microsoft.com/en-us/library/gg430861%28v=pandp.40%29.aspx), if you haven't already :) – Patryk Ćwiek May 22 '12 at 17:51
  • That's not exactly what I am looking for. My navigation works fine. What I want to achieve is an interaction inside the contactmodule with the ordermodule, while the contactmodule knows nothing about orders. – csteinmueller May 23 '12 at 07:51
  • The point of your loose coupling is that you can individuele test it. This is not the case when you have a reference using the OrderModule.dll. So you can just add an additional property `List Orders` and use that for your orders of that specific customer. If your order how ever exists in the ordermodule, then you are doing it wrong. Because it is part of your "Domain Layer" it needs to be application wide so you can re-use it. So you put these models/entity in a seperate dll like ApplicationName.Domain – Rik van den Berg May 23 '12 at 12:25
  • You should read the question.I don't have a reference to OrderModule.dll. The only thing the ordermodule knows is the customer model in my infrastructure dll. My current solution is based on my approach in the question. My customermodule's ribbontab has a "specialRegion" for other modules injections. – csteinmueller May 23 '12 at 12:32
  • But I'm open for further suggestions. – csteinmueller May 23 '12 at 12:34

1 Answers1

0

I think that normally, the Open customer's orders button should come from the customer module, not the order module. Clicking this button could either...

  • Raise a navigation request with a URI like /ShowCustomerOrders?CustID=1234, which the Orders module would understand and pick up
  • Open a view containing a region with a name like "CustomerOrders", and then insert the Customer ID into the region context. The Orders module would register its customer orders view with view discovery.

Neither of these options requires adding a reference to the OrderModule.dll, so this doesn't add coupling. However, if the Orders module is missing, then the navigation will do nothing, or the view will come up empty.

If you want to avoid the button from appearing if the Orders module isn't present, then you could instead get the Orders module to add the button to the customer ribbon via view discovery. It would then have to pick up the customer Id for the current customer from the region context, which would give it enough information to be able to open the correct customer orders view when clicked.

Mark
  • 1,784
  • 16
  • 26