Load data from another module

Topics: Writing modules
Oct 6, 2011 at 1:34 PM
Edited Oct 6, 2011 at 1:34 PM

I need help in one question. So, I explore posibility to make some relations between modules. For example, I have 2 separated modules: Departments and Employees, both of them has more then 10 columns in DataBase. In Department module I created EmployeePartRecord (much shorter then original in Employee module, just Id and Name, this is all I need in Department module), but then I tried to get Employees data from Departments module I receive empty result. This happens because Department module try to load data from table with Departments_ prefix (should be Emloyee_ prefix).

So, is exist posibility to load data from another table, not from [ModuleName]_[NamePartRecord] ?

Is this good practice? I know that I can make dependencies between projects and it will works, but I want to make 'standalone' modules.


Oct 6, 2011 at 4:04 PM

Typically if you have two modules but you want to share the data between them you would create a Service and put the appropriate methods to get at that data on the service which can be called from other modules.  Plenty of the modules in the project currently do this.  Check out the Orchard.Blogs module for a quick example.