コード例 #1
0
ファイル: Program.cs プロジェクト: yqowen/GenericData
 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();
     }
 }
コード例 #2
0
ファイル: GenericHandler.cs プロジェクト: yqowen/GenericData
 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;
 }
コード例 #3
0
ファイル: BaseHandler.cs プロジェクト: yqowen/GenericData
 public abstract bool Process(Request request, ServerConfig config, out Response response);