I'm having trouble figuring out how to retrieve data from SQL and store into the appropriate subtype. For example, I have an inventory system. I have a base class called "Assets" and I have the following subclasses which extend from "Assets": 1. Laptop (has speed and memory fields) 2. MobileDevice (has esn and PIN fields)
Each subclass has its own unique fields (as shown above) and they share common fields (i.e. make, model, serial no. etc...). My question is, if someone performs a search of all assets for a particular user via a webpage, the resultset would include any number of these different types. If I click on "view details" for an iPhone, how do I tell the page to load a MobileDevice vs. Laptop. Right now, I am only able to pull results as an Asset, but then I'm missing those unique fields. Is this even possible? I cant seem to find anything on the web. is it just a matter of casting? Please help! Please note: I'm using C#, but no LINQ. Just stored procedures etc... Appreciate any help.
Aucun commentaire:
Enregistrer un commentaire