PCTrade Sample Server - WPF
This application is one of four available samples that can act as a server for the client applications in the Data Abstract Samples Suite. It is implemented using WPF, and within the four versions provides the richest set of information about the underlying activities of Data Abstract.
While "real life" middle-tier servers are usually black boxes that run without any user interface or as Windows Services or Daemons, this sample - for illustration purposes - takes the opposite approach and for each request made from a client provides a rich overview of the processing that the Data Abstract library did underneath the hood to service the request. Thus, it provides a great opportunity to learn how Data Abstract works.
The interface of the WPF PCTrade Sample Server is split into separate parts:
Schema and Connection Control
On the left-hand column, the server provides a list of all available connections configured within the server. By default, the server is set up to serve data from the zero-deployment SQLite database that shops with DA, but other databases can be selected from the list, provided they are configured correctly (upon selection, the server app will verify the connection and provide you with an error message if something is amiss).
Below, buttons are provided to launch Schema Modeler to view the schema, to start/stop the server from accepting requests, and to clear all current sessions.
The remainder of the application window starts out empty, but will fill to display Tabs for each active client session. As shown below, each of these tabs is named after the client application that created it (in this case, "PCTrade for iPhone", and also provides more details about the client, such as its Session ID, when the session was created or last accessed, as well as an image representing the platform and tool this client was written for (in this case, an iPhone application written using Data Abstract for Xcode).
Inside the session box, separate tabs are shown for each request that was received and executed for the client - be it a data fetch or an update. For each request, more details are provided on the request type and the work that was involved in solving the request (if more than one table was fetched using a single request, this data is again partitioned on a third level of tabs).
In the screenshot below we see that the iPhone client has made four separate requests to fetch data (calling DA's "GetData"method). The particular request we are looking at was using DA SQL, with the query sent from the client being
SELECT * FROM Clients ORDER BY ClientName
The SQL Log below shows the actual query that was run against the SQLite backend database; in this case:
SELECT "Id", "Name", "Phone", "Address", "Remarks", "Discount" FROM "Customers" ORDER BY "Name"
You can see how the Column Mappings from the schema were applied to match schema names such as "Clients" and "ClientName" to the database names, "Customers" and "Name".
For different types of request (such as using Dynamic Where or plain table request), a different set of information will be shown, as appropriate.
Editions and Languages
- Data Abstract for .NET — available in C# and as pre-compiled executable