Exemplo n.º 1
0
 public override void OnGet(HttpRequest request, HttpResponse response)
 {
     if (request.RestConvention != null)//根据ID获得数据库
     {
         Log.Debug(string.Format("返回ID{0}的数据库信息", request.RestConvention));
         int id = -1;
         try
         {
             id = Convert.ToInt32(request.RestConvention);
         }
         catch
         {
         }
         Dataset da = Dataset.CreateInstanceFromDataAngineModel(bll.GetModel(id));
         if (null != da)
         {
             response.SetContent(da.ToJson());
         }
     }
     else if (request.Domain != null)//获得所有数据库
     {
         Log.Debug(string.Format("返回所哟数据库信息", request.RestConvention));
         List <DataAngine_Set.Model.dataset> datasets = bll.DataTableToList(bll.GetAllList().Tables[0]);
         response.SetContent(JsonConvert.SerializeObject(Dataset.CreateInstanceFromDataAngineModel(datasets.ToArray())));
     }
     response.Send();
 }