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 7196871
In Process

The Archive Base Latest Questions

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

I have to create a program that would upload business data to the FTP

  • 0

I have to create a program that would upload business data to the FTP site. I am developing this program in C#.

So I have created dependent classes for this program as follows

IData – to fetch the data from the database
IDataTransform – convert the data received from database to specific format as client requested
IFtpOperation – uploads the file from local disk
ISettings- It holds all the relevant configurations such connection string, FTP server location, credential etc.,

Here is the code of it

    public interface IFtpOperation
{
    void Upload(string localFilePath);
}

public interface IDataTransform<in T1, out T2>
{
    T2 Transform(T1 input);
}

public interface IData<in T1, out T2>
{
    T2 GetData(T1 input);
}

public interface ISettings
{
    T GetValue<T>(string key);
}

Then I created another class that wires these operations. The above interfaces being passed as constructor parameter to this class. This class contains a method UploadCustomerData that call the methods in dependencies as required.

Here is the code

public class UploadFileViaFTP
{
    private readonly IFtpOperation _ftp;
    private readonly IData<int, IList<CustomerData>> _customerData;
    private readonly IDataTransform<CustomerData, string> _transformer;
    private readonly ISettings _settings;

    public UploadFileViaFTP(IFtpOperation ftp, IData<int, IList<CustomerData>> customerData,
        IDataTransform<CustomerData, string> transformer, ISettings settings)
    {
        _ftp = ftp;
        _transformer = transformer;
        _customerData = customerData;
        _settings = settings;
    }

    public void WriteToDisk(IList<CustomerData> customers, string localFilePath)
    {
        using (var writer = new StreamWriter(localFilePath))
        {
            foreach (var customer in customers)
            {
                writer.WriteLine(_transformer.Transform(customer));
            }
        }
    }

    private void UploadCustomerData(int accountId)
    {
        var customerData = _customerData.GetData(accountId);
        if (customerData.Count > 0)
        {
            var localPath = _settings.GetValue<string>("LocalFilePath");
            WriteToDisk(customerData, localPath);
            _ftp.Upload(localPath);
        }
        else
        {
            _notificationMessage.AppendLine(
                string.Format("There could be an error or no data avaiable to upload at {0} for account {1}.", DateTime.Now, accountId));
        }
    }
}

Now my question is where does this class UploadFileViaFTP lives. In service layer or business layer? And please explain why is that?

I hope explained in detail.

  • 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-28T20:51:40+00:00Added an answer on May 28, 2026 at 8:51 pm

    It seems like it’s more like a façade (learn more here). And this is business layer.

    After all, UploadFilesViaFTP should be available in service operations or in a single tier application (a good indication for living in business layer).

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

Sidebar

Related Questions

The goal behind this question is to create a portable Windows script/program that would
I have been trying to create a Ruby program that will be running online
I have created a non-form c# program that uses the NotifyIcon class. The text
I have a program that starts up and creates an in-memory data model and
I have to create a C# program that deals well with reading in huge
I have a winform program that allows users to upload Shockwave Flash movies to
I have to create BYTE* array that will store some text and binary data
I was thinking about how to create a program that would only be valid
I have to create a program that displays the 9 rows of a sudoku
i created an exercise program that create a dynamic menu from json. and then,

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.