locked
3 Tier Architecture with data from external app RRS feed

  • Question

  • Hello,

    I am working on developing a financial derivatives application that needs to read in XML files that are produced by a our accounting platform and then display the data to the user in a meaningful way (perhaps a datagrid). The user would then review the data, make any changes if necessary, then the program would proceed with a set of mathematical operations. The end goal is to produce an Excel file for them to view when the process is complete.

    I am trying to lay this out in a typical 3 tier architecture, but I don't know how to go about constructing the data access layer. The data XML file is produced via another application (not an SQL database). At some point I'll need to call this application via command line, get the XML file, and then use that XML file in my application. How would I construct a class or set of classes that makes sense here? In what layer/class do the methods for calling the external application go?

    Thanks in advance.

    Saturday, April 21, 2012 6:10 PM

Answers

  • I would first check if you can open the XML file in Excel a get good results.  Excel ahs the capability of opening XML files, but results vary depending on the schema that was used to generate the XML file.  the easiest way of running an external application from visaul studio is to generate a bat file to execute the commands, or use the SHELL Class to execute the commands from inside a visual studio application.   You can store text string in a visual studio application by put a text box on a form and storing the text in the box.  You can make the text box invisible so the text is protected.

    jdweng

    Saturday, April 21, 2012 9:52 PM
  • At some point I'll need to call this application via command line, get the XML file, and then use that XML file in my application. How would I construct a class or set of classes that makes sense here? In what layer/class do the methods for calling the external application go?

    Thanks in advance.

    Does not matter that your 'data source' is not a traditional database; it still is providing data. Therefore you should make the call and get the data from the XML file in the Data Access Layer. At this point I strongly recommend using LINQ to XML to query the data and place it in strongly typed objects that are returned to your BLL. So you might have a method in the DAL that looks like this:

    Public Function LoadExternalXMLData As List(Of CustomData)
      'Call to get XML file goes here
      'Use LINQ to XML from returned XML data to load 'CustomData'
      'Return List(Of CustomData)
    End Function

    Here is a great article from the Gu and 1 from the MSDN on using LINQ to XML:

    Using LINQ to XML:
    http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx

    Overview of LINQ to XML:
    http://msdn.microsoft.com/en-us/library/bb384460.aspx

    Hope this helps!


    Thank you,

    • Proposed as answer by atconway Thursday, April 26, 2012 8:18 PM
    • Marked as answer by Mike FengModerator Tuesday, May 8, 2012 5:37 AM
    Thursday, April 26, 2012 8:18 PM

All replies

  • I would first check if you can open the XML file in Excel a get good results.  Excel ahs the capability of opening XML files, but results vary depending on the schema that was used to generate the XML file.  the easiest way of running an external application from visaul studio is to generate a bat file to execute the commands, or use the SHELL Class to execute the commands from inside a visual studio application.   You can store text string in a visual studio application by put a text box on a form and storing the text in the box.  You can make the text box invisible so the text is protected.

    jdweng

    Saturday, April 21, 2012 9:52 PM
  • At some point I'll need to call this application via command line, get the XML file, and then use that XML file in my application. How would I construct a class or set of classes that makes sense here? In what layer/class do the methods for calling the external application go?

    Thanks in advance.

    Does not matter that your 'data source' is not a traditional database; it still is providing data. Therefore you should make the call and get the data from the XML file in the Data Access Layer. At this point I strongly recommend using LINQ to XML to query the data and place it in strongly typed objects that are returned to your BLL. So you might have a method in the DAL that looks like this:

    Public Function LoadExternalXMLData As List(Of CustomData)
      'Call to get XML file goes here
      'Use LINQ to XML from returned XML data to load 'CustomData'
      'Return List(Of CustomData)
    End Function

    Here is a great article from the Gu and 1 from the MSDN on using LINQ to XML:

    Using LINQ to XML:
    http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx

    Overview of LINQ to XML:
    http://msdn.microsoft.com/en-us/library/bb384460.aspx

    Hope this helps!


    Thank you,

    • Proposed as answer by atconway Thursday, April 26, 2012 8:18 PM
    • Marked as answer by Mike FengModerator Tuesday, May 8, 2012 5:37 AM
    Thursday, April 26, 2012 8:18 PM