I'm thinking of a mid / large scale project, which will need to store different data types and present them to different clients.
What I'm struggling now is, how to build a data and service layer that can capable of storing different types of objects and query them when needed.
As an example, think of a client - server application in which, clients can only read each individual server's broadcasts, and now think of a scenario where a flower shop and restaurant broadcasts their data to a person on the street with a smart phone.
class SoCalledServer
{
public AccessibleClientData Broadcast(ClientData broadcastMessage)
{
Broadcast(broadcastMessage)
}
}
class RestaurantClient : AbstractClient
{
public SomeGenericDataType menu;
public RestaurantClient()
{
menu = new SomeGenericDataType<List>();
menu.Add("Sushi");
menu.Add("Fried potatoes");
}
public override void BeginBroadcast()
{
server.Broadcast(menu);
}
}
class FlowerShopClient : AbstractClient
{
public SomeGenericDataType flowersOnSale;
public FlowerShopClient()
{
flowersOnSale = new SomeGenericDataType<List>();
flowersOnSale.Add("Daisy");
flowersOnSale.Add("Rose");
}
public void BeginBroadcast()
{
server.Broadcast(flowersOnSale);
}
}
In this example, I have two different types of data (one is a restaurant's menu, and the other is flower shop's flowers) which can have different members of its own (eg. menu has prices and ingredients, flower shop's data has flower names and a description, quantity and / or price etc...) and this "client" samples can be extended.
How should I model such type of application? What kind of database schema I should use to store unidentified and various types of data? How my server and client application should communicate with each other? And the most important how should client get the broadcasted data type (from the generic type)?