private static void OutputResponse(Response response) { var data = response.Payload.Data; foreach (var column in data.Columns) { Console.Write("{0}\t", column); } Console.WriteLine(); foreach (var record in data.Records) { for (var i = 0; i < data.Columns.Count; i++) { Console.Write("{0}\t", record.Values[i]); } Console.WriteLine(); } }
public override bool Process(Request request, ServerConfig config, out Response response) { var schema = config.Schemas.FirstOrDefault(s => s.Id == request.Payload.Schema); if (schema != null) { var connection = config.Connections.FirstOrDefault(c => c.Id == schema.Connection); if (connection != null) { var dataAccess = DataFactory.Find(connection); if (dataAccess != null) { var dataList = dataAccess.Process(request, connection, schema); response = new Response { CreatedDate = DateTime.Now, Id = request.Id, Payload = new Payload { Schema = request.Payload.Schema, Data = dataList }, Tag = request.Tag }; return true; } } } response = null; return true; }
public abstract bool Process(Request request, ServerConfig config, out Response response);