Ejemplo n.º 1
0
        public override async Task <GetEntityReply> GetTable(GetEntityRequest request, ServerCallContext context)
        {
            try
            {
                var table = await _databaseService.GetTable(request.DbName, request.TableName);

                GetEntityReply response = _grpcModelMapper.GetGetEntityReplyFromTableDto(table.table);
                response.Code = 200;

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("***************************************************************************************************************");
                Console.WriteLine("Get table: " + request.TableName);
                Console.WriteLine("***************************************************************************************************************");

                return(response);
            }
            catch (Exception ex)
            {
                return(new GetEntityReply()
                {
                    Code = 400, Message = ex.Message, StackTrace = ex.StackTrace
                });
            }
        }
Ejemplo n.º 2
0
        public GetEntityReply GetGetEntityReplyFromTableDto(Table table)
        {
            var result = new GetEntityReply
            {
                Name = table.Name
            };

            result.Columns.AddRange(table.TableSchema.Fields.Select(x => new Column
            {
                Name          = x.Name,
                DataValueType = (int)x.Type
            }));
            return(result);
        }