Why returning dataset or data table from WCF service is not a good practice? What are the Alternatives?

前端 未结 3 1657
萌比男神i
萌比男神i 2020-12-06 05:38

I am working on University Management System on which I am using a WCF service and in the service I am using DataTables and DataSets for getting data from database and datab

3条回答
  •  伪装坚强ぢ
    2020-12-06 06:21

    There are 3 reason for failed return type as datatable in WCF services

    • You have to specify data table name like:

      MyTable=new DataTable("tableName");
      
    • When you are adding reference on client side of WCF service select reusable dll system.data

    • Specify attribute on datatable member variable like

      [DataMember]
      public DataTable MyTable{ get; set; }
      

提交回复
热议问题