One of the simple approach to the problem is before deserialzing, as you have the access to the xml string of the object, you can use xml dom object to identify the root element of the xml string and have a switch case for all the kinds of object you are going to get from the database.
Based on the root node name, for example if the root node name is Employee then you can deserialze the object to the appropriate type by type casting it.
XmlDocument doc = new XmlDocument();
doc.LoadXml(strXml);
string rootNode = doc.FirstNode().Name;
//Code for deserializing the xml
XmlSerializer mySerializer ;
swicth (rootNode)
{
Case "Employee":
//deserialize to employee type
mySerializer =
new XmlSerializer
(typeof(Employee
));
break;
Case "Videos":
//deserialize to Videos type
mySerializer =
new XmlSerializer
(typeof(Videos
));
break;
default:
//return invalid type
}
object =
mySerializer.
Deserialize(myStream
);
above is not a compiling code, but just a kind of pseudo code..
Hope this solves your problem.