C# 如何在webservice中获取多个输入

C# 如何在webservice中获取多个输入,c#,web-services,C#,Web Services,使用C# 目前我正在使用web服务显示员工详细信息 电流逻辑 Getting the 4 inputs (employee id, name, date of join, email) as a string, sending the input to DB as a parameter and retrieve the procedure output in dataset and displayed the dataset output (employee id, name, date of

使用C#

目前我正在使用web服务显示员工详细信息

电流逻辑

Getting the 4 inputs (employee id, name, date of join, email) as a string, sending the input to DB as a parameter and retrieve the procedure output in dataset and displayed the dataset output (employee id, name, date of join, email, address, passport no, etc). This is working fine for single employee information.
现在我想获取批量员工输入,并在web服务中显示批量员工输出

如何获取批量员工输入的详细信息

例如,如果应用程序想要获得20名员工的详细信息,那么应用程序需要为20名员工提供员工id、姓名、加入日期、电子邮件作为输入

应用程序如何通过dataset或任何其他想法向webservice发送20*4=80输入请求

有人能帮我或建议我吗


如果问题不清楚或有任何疑问,请随时问我。

通常,对于类似的问题,您需要使用附加的数据块(数据本身可以是您喜欢的任何格式,只要您的服务器能够理解并做出相应的响应)。可以想象,您可以在URL中传递它们,但这有点疯狂。

您应该创建一个具有请求属性的类,如:

public class RequestParams
{
    public int employeeID { get; set; }
    public string Name { get; set; }
    public DateTime DateOfJoin { get; set; }
    public string Email { get; set; }
}
这将是您的方法输入参数:

public EmployeesDetails GetDetails(RequestParams[] r)
确保在javascript中使用相同的结构,并使用JSON.Parse正确解析

*编辑,例如:

 [WebMethod]
    public EmployeesDetails GetDetails(RequestParams[] request)
    {


        // Query the database, request contains an array of  RequestParams
    }

public class RequestParams
{
    public int employeeID { get; set; }
    public string Name { get; set; }
    public DateTime DateOfJoin { get; set; }
    public string Email { get; set; }
}
public class EmployeesDetails
{
    public int PassportNumber { get; set; }
}
JSON示例(不要告诉我解析错误,我很快就写了一本手册):


你开发那个web服务吗?你使用什么风格的web服务?web服务已经构建好了,我需要改变逻辑,目前我得到4个输入作为一个字符串,根据新的要求,我需要得到4个输入20次。如何实现此目的用户需要发送批量输入。根据新的逻辑,用户不想发送4个请求20次,用户需要一次性发送4*20输入作为批量请求,这就是我的代码所做的。。看一看WebMethod,因为它接受objectTomerz数组,请您与输入和输出共享一些示例代码,我不完全理解您的逻辑:(完全同意。Get请求有最大长度限制
{'request':[
'RequestParams':{
    'employeeID':'1',
    'Name':'1',
    'DateOfJoin':'1',
    'Email':'sgd@asdf.d'},
    {
    'employeeID':'2',
    'Name':'2',
    'DateOfJoin':'2',
    'Email':'sgd@asdf.d'},
    {
    'employeeID':'3',
    'Name':'3',
    'DateOfJoin':'3',
    'Email':'sgd@asdf.d'},
    {
    'employeeID':'4',
    'Name':'4',
    'DateOfJoin':'4',
    'Email':'sgd@asdf.d'}
}]}