日期:2014-05-20  浏览次数:20877 次

请教一下大家,引用WCF服务之后,数据库中的数据不能正常使用?
PestWCFService.cs代码如下:
public class PestWCFService
{

  public class ImagoSurvey  
  {
  public string city { get; set; }
  public string village { get; set; }
  public decimal longitude { get; set; }
  public decimal latitude { get; set; }
  public string drosophilaType { get; set; }
  }
   
  [OperationContract]
  public List<ImagoSurvey> GetImagoSurveys()
  {
  PestInfoDataContext pestinfo = new PestInfoDataContext();
  var imagodata = from a in pestinfo.ImagoSurvey
  join b in pestinfo.MonitoringPoint on a.MonitoringPointID equals b.MonitoringPointID
  select new ImagoSurvey
  {
  city = b.City,
  village = b.Village,
  drosophilaType = a.DrosophilaType,
  longitude = b.Longitude,
  latitude = b.Latitude,
  };
  return imagodata.ToList();
   

  }

}


在引用服务的代码如下:
private void BtClick(object sender, MouseEventArgs e)
  {
  PestWCFServiceReference1.PestWCFServiceClient WebClient = new PestWCFServiceReference1.PestWCFServiceClient();
  WebClient.OpenAsync();
  WebClient.GetImagoSurveysAsync();
  WebClient.GetImagoSurveysCompleted += new EventHandler<PestWCFServiceReference1.GetImagoSurveysCompletedEventArgs>(WebClient_GetImagoSurveysCompleted1);
  }

  public void WebClient_GetImagoSurveysCompleted1(object sender, PestWCFServiceReference1.GetImagoSurveysCompletedEventArgs e)
  {
   
  ObservableCollection<PestWCFServiceReference1.PestWCFServiceImagoSurvey> Imago = new ObservableCollection<PestWCFServiceReference1.PestWCFServiceImagoSurvey>();
  Imago =e.Result;
  ChartTip.DataContext = Imago;(ChartTip是一个图表控件)
  for (int i = 1; i <= Imago.Count; i++)
  {
  string m = Imago.longitude(正常情况应该是这样显示,怎么在这里Imago.后面不出现longitude 等信息供选择) }

这是怎么回事?谢谢大家指点下。 


------解决方案--------------------
爱莫能助,帮顶一下!