FastReport.Prepare() VERY slow

We are using FastReports to email out invoices in PDF format.

When the code hits the FastReport.Prepare() line, it takes about 15 seconds to return.
Is this normal? Is there some way to speed this up?
String together 100 invoices being emailed out, and it causes our webpage to time out before it finishes.

We are using FR 2015.3.1 and VS2010.

Thanks

Comments

  • edited 8:52PM
    if you're using dotnet 4.5, use async await for long running task
    private async void createPDFandEmail()
    {
        await Task.Run(() =>
        {
             //FASTREPORT CODE
        });
    }
    
  • edited 8:52PM
    No, we're using .Net 4.0.

    We're finding that upgrading our app to 4.5 is proving rather difficult.
  • edited October 2016
    in .net 4.0 : you can use Tasks Factory

    in .net 2.0/3.5 : you can use threadpool
    public void RunInBackground()
    {
        System.Threading.ThreadPool.QueueUserWorkItem(DoSomething);
    }
    
    private void DoSomething(object stateInfo)
    {
        //running in background thread
    }
    
  • I am facing the same problem.

    When I tried to generate a particular report ,the fast report.prepare() gets timeout and making service down.

    I removed a property in datasource which was not part of api response ,then the solution is up and able to generate report fastly.

    I am not sure what is the exact issue behind it. Can someone help to find the root cause?

  • Hello!

    Retrieve the data once at the application level (using Entity Framework, Dapper or ADO.NET) into memory (a DataTable or an IEnumerable<T> collection of models) and register the resulting slice in the report:

    // Pre-fetch data into memory
    DataTable invoiceData = GetInvoiceData(invoiceId);
    
    using (var report = new Report())
    {
    report.Load(templateStream);
    report.RegisterData(invoiceData, ‘Invoices’);
    report.GetDataSource(‘Invoices’).Enabled = true;
    
    report.Prepare();
    
    using (var pdf = new PDFExport())
    {
    report.Export(pdf, pdfStream);
    }
    
This discussion has been closed.