简体   繁体   中英

asynchronous call back wcf service r

在此处输入图片说明

i was develop wcf service which is fine,there is Operationcontract return dataset showed in picture, my question is how do i make which Operationcontract method asyn ??

[OperationContract(Name ="GetBirthday")]
        [WebGet]
        DataSet GetEmployeeBirthDateDetail(List<string> birthdayStringlist, out string userExceptionMessage);

   public  DataSet GetEmployeeBirthDateDetail(List<string> birthdayStringlist , out string message)
        {
            try
            {
                string scripts;
                List<string> outlist = new List<string>();
                generateScripts gs = new generateScripts();
                StringValidation sv = new StringValidation();
                DataSet ds = new DataSet();
                message = sv.validate(birthdayStringlist, out outlist);

                if (message == "")
                {

                    scripts = gs.GenerateScripts(outlist, employeetype.GenerateScripts_BdayEmp);
                    message = "success";
                    return  api.GetEmployeeDetails(scripts);
                }

                else
                {
                    message = "No records to provide";
                    return null;
                }
            }
            catch (Exception ex)
            {

                message = ex.Message;
                WriteToLog(ex.Message);
                return null;
            }
        }

public async Task GetGetEmployeeJoinDateDetailAsync(List joindateStringlist) { try { string scripts; List outlist = new List(); generateScripts gs = new generateScripts(); StringValidation sv = new StringValidation();

            if (sv.validate(joindateStringlist, out outlist) == "")
            {

                scripts = gs.GenerateScripts(outlist, employeetype.GenerateScripts_NewJoin);
                return await Task.Factory.StartNew(() => api.GetEmployeeDetails(scripts)) ;
            }
            else
            {
                return null;
            }

        }

        catch (Exception ex)
        {

            WriteToLog(ex.Message);
            return null;
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM