Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1068243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:15:39+00:00 2026-05-16T20:15:39+00:00

I’m working on a project where I have to take data from one source

  • 0

I’m working on a project where I have to take data from one source and translate/tweak it so that it can be properly consumed by a different source, in this case, the database. I imagine this is a fairly common problem, and while I believe I’m off to a good start, I’m stuck as to how best to implement the middle part of the solution that is responsible for parsing the original data and making that data available to the next part of my process.

Let’s say that I have a web service on my company’s server that is responsible for receiving a sales order provided by a third-party vendor. After the web service is called by the vendor, I should have a strongly-typed object called MyVendor.CustomOrder. I am then responsible for parsing the MyVendor.CustomOrder instance to get the data properly formatted as an “order” in my company’s system.

I already have stored procedures for inserting data into the database and I’ve even created helper methods to communicate with stored procs. I also have interfaces such as IOrderHeader, IOrderPayment, etc., to exist as a “contract” for the data to be consumed by those helper methods.

I’m trying to figure out if a good pattern exists for parsing the data in the original MyVendor.CustomOrder object to provide data for the IOrderHeader et al interfaces. Here’s how I might visualize how the pieces come together (in a marginally helpful ASCII diagram) :

________________________________
|                              |
| Web Service to receive order | 
|                              |   
|  __________________________  |
|__|                        |__|
   |  MyVendor.CustomOrder  |
   |________________________|

               ||
               ||
               \/
   __________________________
   |                        |
   | ?????????????????????? |
   |          Parse         |
   |  MyVendor.CustomOrder  |
   |   and pass data to     |
   |        next step       |
   | ?????????????????????? |
   |________________________|

               ||
               ||
               \/
        _________________________   
        |                       |
________|________               |
| IOrderHeader  |               | 
|_______________|   Methods     |
________|________     to        |
| IOrderPayment |   Add Data    |
|_______________|     to        |
________|________   Database    |
| IOrderDiscount|               |
|_______________|               |
________|________               |
|  IOrderItem   |               |
|_______________|               |
        |_______________________|

               ||
               ||
               \/
   __________________________
   |                        |
   | Data Access Layer,     |
   | Database, etc....      |
   |________________________|      

The only idea I have thus far is to make one giant class that handles everything, possibly like so:

public class MyVendorCustomOrderParserAndDatabaseUpdater
{
     private IOrderItem _IOrderItem;
     //other private interface instantiations

     public MyVendorCustomOrderParserAndDatabaseUpdater(
                MyVendor.CustomerOrder customOrder)
     {
          ParseOrderIntoInterfaces(customOrder);
     }

     private void ParseOrderIntoInterfaces(
                 MyVendor.CustomOrder customOrder)
     {
          //Parse customOrder into _IOrderItem, etc.
     }

     public bool SendOrderToTheSystem()
     {
         //Call the helper methods with the data
         //from the private _IOrderHeader, etc. objects
         //to update "the system"
     }
}

I would then consume this object with some code like this:

... = new MyVendorCustomOrderParserAndDatabaseUpdater(
        customOrder).SendOrderToTheySystem();

I’m interested to know if there are better patterns for solving this problem of getting data from one format so that it can be consumed properly in a different environment.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:15:40+00:00Added an answer on May 16, 2026 at 8:15 pm

    This seems a good case for the adapter pattern.

    Convert the interface of some class b
    into an interface a that some client
    class c understands.

    If you receive orders from different third-party vendors you would create one adapter for each vendor and then you could even employ a factory pattern to create the correct adapter for a given vendor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.