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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:50:06+00:00 2026-05-20T04:50:06+00:00

Let’s imagine we got the following: A) Factory interface such as public interface IEmployeeFactory

  • 0

Let’s imagine we got the following:

A) Factory interface such as

public interface IEmployeeFactory
{        
    IEmployee CreateEmployee(Person person, Constants.EmployeeType type, DateTime hiredate);
}

B) Concrete factory such as

public sealed class EmployeeFactory : Interfaces.IEmployeeFactory
{        
    public Interfaces.IEmployee CreateEmployee(Person person, Constants.EmployeeType type, DateTime hiredate)
    {
        switch(type)
        {
        case BusinessObjects.Common.Constants.EmployeeType.MANAGER:
            {
                return new Concrete.Manager(person, hiredate);
            }
        case BusinessObjects.Common.Constants.EmployeeType.SALES:
            {
                return new Concrete.Sales(person, hiredate);
            }
        default:
            {
                throw new ArgumentException("Invalid employee type");
            }
        }
    }
}

C) Employees family: Manager and Sales inherited from an abstract Employee.

More on my simple) architecture

Some client code

public sealed class EmployeeFactoryClient
{
    private Interfaces.IEmployeeFactory factory;
    private IDictionary<String, Interfaces.IEmployee> employees;

    public Interfaces.IEmployee this[String key]
    {
        get { return this.employees[key]; }
        set { this.employees[key] = value; }
    }
    public EmployeeFactoryClient(Interfaces.IEmployeeFactory factory)
    {
        this.factory   = factory;
        this.employees = new Dictionary<String, Interfaces.IEmployee>();
    }
    public void AddEmployee(Person person, Constants.EmployeeType type, DateTime hiredate, String key)
    {            
        this.employees.Add(
            new KeyValuePair<String, Interfaces.IEmployee>(
                key,
                this.factory.CreateEmployee(
                    person,
                    type,
                    hiredate
                )
            )
        );            
    }
    public void RemoveEmployee(String key)
    {
        this.employees.Remove(key);
    }
    public void ListAll()
    {
        foreach(var item in this.employees)
        {
            Console.WriteLine(
                "Employee ID: " + item.Key.ToString() + 
                "; Details: "   + item.Value.ToString()
            );
        }
    }
}
class ApplicationShell
{
    public static void Main()
    {
        var client = new EmployeeFactoryClient(new EmployeeFactory());
        client.AddEmployee(
            new Person {
                FirstName = "Walter",
                LastName  = "Bishop",
                Gender    = BusinessObjects.Common.Constants.SexType.MALE,
                Birthday  = new DateTime()
            },
            BusinessObjects.Common.Constants.EmployeeType.MANAGER,
            new DateTime(),
            "A0001M"
        );
        Console.WriteLine(client["A0001M"].ToString());
        Console.ReadLine();
    }
}

I wanted to ask about some business logic architecture details.
Using the architecture I can’t design what the Company class should be, don’t know how do I integrate it.

I have read that it more appropriate to use Role-based architecture in such cases. Could you provide an example (Company, Employees entities)?


Thanks!

  • 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-20T04:50:07+00:00Added an answer on May 20, 2026 at 4:50 am

    Are you sure you included the override keyword in the ToString() method?

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

Sidebar

Related Questions

Let's say I have the following entity: public class Store { public List<Product> Products
let's say I have the following string: string s = A B C D
Let's say I create an object like this: Person: NSString *name; NSString *phone; NSString
let's say.. I have the following java bean. Case1: (Student Bean) Integer id; String
Let's say I got this string: $str = alemylaife; (I know it's misspelled, all
Let's say I have a domain object with the following field: private Map<StatType, Double>
Let's say that I've got a sheet - number one - with over 5000
Let's say I have such MYSQL table for logins: id---name---location---login_date ---------------------------------- 1----mike----usa-----21.08.2012 2----tony----uk------22.08.2012 3----tony----uk------23.08.2012
Let's say I have this interface: // .h @interface DataObject : NSObject { NSString*
Let's say that I have classes like this: public class Parent { public int

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.