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

  • Home
  • SEARCH
  • 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 8609589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:54:59+00:00 2026-06-12T03:54:59+00:00

I’m currently working on an integration project to connect two disparate systems. My plan

  • 0

I’m currently working on an integration project to connect two disparate systems.
My plan is to setup an HTTP-API to allow System A to issue commands through HTTP-POST to System B.
The commands will be used to issue CRUD instructions to a SQL server database to retrieve and update membership card data (e.g. ‘create membership’, ‘update membership’, etc.) and then return the data to System A as XML. I know n-tier design dictates that I should have a MembershipCard class with several properties:

public class MembershipCard
{
    private string number;
    private decimal points;

    public string Number
    {
        get { return number; }
        set { number = value; }
    }

    public decimal Points
    {
        get { return points; }
        set { points = value; }
    }

Along with several methods that make calls to the DAL:

    public string GetPoints(string cardnumber) 
    {
        return MembershipCardDB.BalanceRequest(cardnumber);
    }

However, I’m having some difficulty justifying this approach as the static DAL class, MembershipCardDB seems to perform all the work that I need (seen below):

    public static string BalanceRequest(string cardNumber)
    {
        string response = string.Empty;
        string sqlselect = 
            "SELECT Balance                         " +
            "FROM tbl_MemberShipCard                " +
            "WHERE Card_No = @cardNumber                 " +
            "FOR XML PATH ('Card'), ROOT('CardBalance')";

        using (SqlConnection connect = new SqlConnection("Data Source=TEST\\TEST;Initial Catalog=TEST;User Id=sa;Password=TEST"))
        {
            connect.Open();
            using (SqlCommand command = new SqlCommand(sqlselect))
            {
                command.Parameters.AddWithValue("@cardNumber", cardNumber);
                response = (string)command.ExecuteScalar();
            }
        }
        return response;
    }

Is there anything that I’m overlooking by simply removing the MembershipCard class and just pulling the data from the database and formatting it as XML?

  • 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-06-12T03:55:01+00:00Added an answer on June 12, 2026 at 3:55 am

    The point is that you should be able to write your program logic independently from any database interface or xml format. Put all the database stuff into a separate class that loads and creates the objects. Do whatever you want to do with the objects. Finally store the objects back to the database or to xml. If your code is only about importing and exporting data, however, you can drop the extra classes.

    By the way, you can simplify the MembershipCard class by using auto-implemented properties:

    public class MembershipCard
    {
        public string Number { get; set; }
        public decimal Points { get; set; }
    }
    

    I often have a static DB class

    public static class DB
    {
        public static string GetBalanceRequest(string cardNumber)
        {
            ...
        }
    
        public static MembershipCard LoadMembershipCard(string cardNumber)
        {
            ...
        }
    
        public static List<MembershipCard> LoadMembershipCards()
        {
            ...
        }
    
        public static void SaveMembershipCard(MembershipCard membershipCard)
        {
            ...
        }
    }
    

    Your MembershipCard class could have a method

        public string BalanceRequest()
        {
            return DB.GetBalanceRequest(this.Number);
        }
    

    Like this you have a separation of database operations and other application logic.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
I am currently running into a problem where an element is coming back from
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm making a simple page using Google Maps API 3. My first. One marker

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.