Hey, all you Adapter gurus...I'm just starting to delve into Adapter as part of a new module I'm working using a distributed architecture. Here's the question:
I'm working on an Inventory module. I have defined an "InventoryItem" object that represents a known part in inventory. I have also defined a "StockTransaction" object that represents the event in which Inventory Items are either pulled from stock, or put into stock. The current stock level of the Inventory Item is represented by the sum of transactions against stock:
CurrentStockLevel =
SELECT SUM(AmountApplied)
FROM StockTransaction
WHERE InventoryItemID = @inventoryItemID
I want to add the CurrentStockLevel as a property of the "InventoryItem" entity. Not a problem in Self-Servicing, but as I am using Adapter against a distributed architecture, what would be the best way to implement this?
There's an example in the documentation, "Extending the Framework Through Inheritance", that seemingly speaks to this, but it looks more like an example for Self-Servicing than Adapter (the example iterates through the OrderDetails collection without first loading it).
I need to have the value for the "CurrentStockLevel" property populated when the entity is fetched from the database, not when the GUI calls into it, otherwise I'll get chatty entities, and no centralized data access (defeating the purpose of Adapter). Any thoughts?
Jeff...