Home > Net >  Use the Process launcher EF implementation
Use the Process launcher EF implementation

Time:03-09

I use the Process in the project launched an exe program the program need to read data in the database, but in the first use of EF operation database are especially slow need 3-5 minutes of time, but if people to click exe launcher is particularly fast, use the Process launcher why lead to this result?
Below is I use the Process start the program code,
 

Private static void Start (string filePath)
{
The FileInfo the FileInfo=new the FileInfo (filePath);
if (! The fileInfo. Return the Exists);
The Process dataCenterProcess;
DataCenterProcess=new Process ();
DataCenterProcess. StartInfo. FileName=the fileInfo. FullName;

DataCenterProcess. StartInfo. RedirectStandardInput=true;
DataCenterProcess. StartInfo. RedirectStandardOutput=true;
DataCenterProcess. StartInfo. CreateNoWindow=true;
DataCenterProcess. StartInfo. UseShellExecute=false;
DataCenterProcess. StartInfo. WorkingDirectory=the fileInfo. DirectoryName;

DataCenterProcess. Start ();

}

CodePudding user response:

Start the program with a Process, the used again after the first use of Ef Ef operation quickly, Ef action part shouldn't be a problem, because when manually start the program simply won't appear this problem

CodePudding user response:

(it's even... I found the reason, the reason is the Process. The StartInfo. RedirectStandardInput=true and Process. The StartInfo. RedirectStandardOutput=true; This two question,
I changed to False will not appear again after waiting for long time.
  •  Tags:  
  • C#
  • Related