Setting File Buffer Size For Performance

Index

    Setting File Buffer Size For Performance

    Generating EDI files can consume a lot of memory and effect performance.  One way to improve the speed when generating EDI files is to specify an approximate length (in terms of the amount of characters).  The internal buffers will not need to recreate itself with more space.  By default the FileBufferSize is set to 2000 characters.  This number should be changed if you plan to generate an EDI file larger than 2000 characters (which is most likely the case).

    Example

    // Instantiate an instance of EDIDocument and set filepath
    EDIDocument sampleEDIFile = new EDIDocument(“C:\\edi.txt”);
     
    // Set the file buffer size
    sampleEDIFile.FileBufferSize = 2000000;

    // Create an interchange loop. This loop will contain all other loops in the EDI structure
    Loop interchangeHeaderLoop = new Loop(“Interchange Header”);

    // Add the interchange loop to the EDI document
    sampleEDIFile.Loops.Add(interchangeHeaderLoop);

    // Generate the EDI file
    sampleEDIFile.GenerateEDIFile();
    in EDI Document
    Did this article answer your question?