Question regarding proper use for a task in C #

I have a question regarding Tasks. I have a WCF application that has a ReceiveEmpInfo method that will be called from a client application.

WCF Server Application:

public void ReceiveEmpInfo(string EmpName, string EmpId)
{
    DifferentClass.SaveEmpToDB(string EmpName, string EmpId);
    return;
}

My requirement: I want to return this method call ( ReceiveEmpInfo()) after the method call SaveEmpToDB(), I do not want to hold the client call until the method SaveEmpToDB()stores the data in the database. I am thinking about using a task, but I'm not sure that it will solve my requirement.

Please give me your suggestions.

Thanks Joe

+3
source share
4 answers

, . Task.Start() WCF , "background". , WCF IIS. , IIS ( ), [] .

BTW: , : System.Threading.Tasks.Task

+2

:

WCF ?

, .

0

"--", . .

[ServiceContract]
interface ISomeContract
{
   [OperationContract(IsOneWay = true)]
   void ReceiveEmpInfo(string EmpName, string EmpId)
}
0

All Articles