5

WebMethodレイヤーからクライアントにデータを返すプロセスを合理化し、クライアントからの一連のパラメーターを次のDictionary<string,string>ように表現しようとしています:

    [WebMethod(EnableSession = true)]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public static override ResultObject<List<PatientInfo>> GetResults(Dictionary<string, string> query)
    {
        ResultObject<List<PatientInfo>> resultObject = null;

        if (!query.ContainsKey("finValue")) 
        {
            resultObject = new ResultObject<List<PatientInfo>>("Missing finValue parameter from the query");
        }

        string finValue = query["finValue"];

        if(finValue == null)
        {
            resultObject = new ResultObject<List<PatientInfo>>("Missing finValue parameter value from the query");
        }

        var patientData =  GetPatientsByFin(finValue);
        resultObject = new ResultObject<List<PatientInfo>>(patientData);
        return resultObject;

    }
}

私の質問は、Dictionary パラメータを渡して逆シリアル化するにはどうすればよいですか?

4

2 に答える 2