Hey there,
I'm working on an ERP application where multiple inventories need to be dynamically supported, ie. each depot/branch needs a separate stock value for each product. One approach - avoiding using static table columns - is to have a separate Stock table as follows:
[Product]
Code
...
[Branch]
Code
...
[Stock]
ProductCode
BranchCode
StockValue
...
This effectively becomes a many-to-many relationship separated by the Stock table. Immediately there appears to be pitfalls in this approach, for instance:
- If there are 5 branches (depots), and 50k product lines, then there will be 5*50k Stock lines. Is this excessive?
- Each time a Product is added, 5 new Stock lines need to be added - one for each Branch.
- Each time a Branch is added, 50k new Stock lines need to be added.
The main rationale behind this is to avoid using static columns (which may lead to modifying the mapping files as new Branches are added). So it is supposed to be more dynamic.
Has anyone worked with a similar concept in the past and may perhaps have a more efficient solution? Or if this appears to be a suitable solution, then what NHibernate association method may be most effective?
Thanks.