Lookup data

Topics: Prism v4 - WPF 4
Mar 2, 2014 at 7:47 PM

I have created a Prism application that contains a single module to manage a list of contacts (ContactModule). Each contact contains geographical data (country, postalcode) that are stored in separate lookup tables in my database. The user must be able to add/edit these data.
How can I handle them? My first thought is to create one module for each lookup table and cache them, so that they are always available in ContactModule. Do you have any better idea?

Mar 6, 2014 at 4:36 PM

Any ideas about the current issue?
I think the best approach is to add lookup data in the ContactModule and not creating a separate for each one. I could then create separate Views and ViewModels for each lookup entity.
What do you think?

Mar 6, 2014 at 6:56 PM

Based on my understanding, both alternatives you mentioned would work properly, and I believe that design and structure of Modules would depend on the solution's complexity and each developer's design likes.

Nevertheless, you should notice that an extra communication between modules would be needed for the first approach. For example, you would need to use EventAggregator service in order to cache the tables in the ContactModule.

Using one only module for the lookup data feature instead, it would keep the search and database service tasks centralized, without the need of a loosely coupled communication. You would certainly manage and control the databases separately by defining different Views/ViewModels for a more firendly UI experience.

As I mentioned, you should define the module's scope by keeping in mind the reason of why each Module was defined and what set of features is packaging.

You can find more related information in the following MSDN Prism Guide chapter:

I hope this helped you.

Gabriel Ostrowsky.
Marked as answer by abampakos on 3/6/2014 at 11:57 PM