Dynamic Post Reflection 

Posted by Ron Rechtman Wednesday, January 27, 2010 3:59:31 PM

I had a problem with one of my clients that each time i turned around the data needed to be posted to someone new...

So I decided to create an configurable posting mechanism. A UI that you place the URL and some static data for the partner and a mapping section.

What I came up with is:

  1. The Admin UI has a DataList which the postback will build the XML as needed to be stored in the database.
  2. Some reflection code based off the XML that build the string to post to the 3rd party.

The hardest part was figuring out the reflection so the object with the data in it, lets call it Cutomer c, to get c.FirstName dynamically it is done by c.GetType().GetProperty("FirstName").GetValue(c, null).

Not too bad at the end.

Share This Using Popular Bookmarking Services
You must sign in to this site to post comments.
Site Map | Printable View | © 2008 - 2010 NuRoN Consulting, INC | Powered by mojoPortal | XHTML 1.0 | CSS | Original design by Andreas Viklund | Designed by NuRoN Consulting, INC.
Share This Using Popular Bookmarking Services