Steve Trefethen
Contact me
About Me View my LinkedIn profile

Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?
Need consulting?
Need Consulting?

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Processing fixed length or delimited files quickly and easily in .NET

October 23 2007 8:22AM
I recently ran into a really useful Open Source project called FileHelpers by Marcos Meli. FileHelpers is a .NET library used to import and export data to/from fixed length or delimited text files. The library is highly customizable with good documentation, lots of examples and a record class wizard to help you build classes that match your data.

FileHelpers record class wizard screenshot

It even supports master detail as well as multi-record mappings making it easy to work with all sorts of structured flat file data.

I’ve been working on a large ERP system and I’m currently focused on adding support for EDI Invoicing. EDI is a set of standards for structuring data that’s passed electronically between trading partners. EDI files are structured plain text files and I’m currently investigating FileHelpers MultiRecordEngine class for use with producing and consuming EDI files. I’ve only spent a few hours so far and I already have basic reading and writing of EDI 810 Invoices working.

One thing I did want to mention is that the example on the site for hooking up events is incorrect so here is an example of subscribing to the AfterWriteRecord event:

m_engine = new MultiRecordEngine(GetSelector(), GetRecordTypes()); m_engine.AfterWriteRecord += new EventHandler<AfterWriteRecordEventArgs<object>>(AfterWriteRecord); private void AfterWriteRecord(object sender, AfterWriteRecordEventArgs<object> e) { ... }

Tags: , ,

Comments

11/4/2007 6:04:29 PM #

shankar

Thanks Steve for Publishing the find.  It is very good.

shankar

11/5/2007 3:57:31 AM #

Steve Trefethen

Hi shankar,
You're welcome, I'm glad you've found it useful.

Steve Trefethen

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Spam filtering provided by: Spam Counter
340 comments approved, 1526 spam caught since October 28, 2009
Powered by Commentor