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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:39:59+00:00 2026-05-10T17:39:59+00:00

Originally there was the DAL object which my BO’s called for info and then

  • 0

Originally there was the DAL object which my BO’s called for info and then passed to UI. Then I started noticing reduced code in UI and there were Controller classes. What’s the decent recomendation.

I currently structure mine

Public Class OrderDAL      Private _id Integer     Private _order as Order      Public Function GetOrder(id as Integer) as Order          ...return Order      End Function  End Class 

then I have controller classes (recently implemented this style)

Public Class OrderController      Private Shared _orderDAL as new OrderDAL      Public Shared Function GetOrder(id) As Order          Return _orderDAL.GetOrder(id)      End Function  End Class 

Then in my application

My app Sub      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click          msgbox(OrderController.GetOrder(12345).Customer.Name)      End Sub   End app 

I originally found that with the Shared Class I didn’t have to keep creating a new instance of the DAL whenever I need to fetch data

Dim _orderDAL as New OrderDal  _orderDAL.GetOrder(1234)  ..... 

What’s your take?

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. 2026-05-10T17:39:59+00:00Added an answer on May 10, 2026 at 5:39 pm

    I’ve used your solution in the past, and the only problem I faced is that ‘Shared’ or ‘static’ methods don’t support inheritance. When your application grows, you might very well need to support different types of ‘OrderControllers’.

    The estabilished way of supporting different OrderControllers would be, in theory, to create a factory:

    OrderControllerFactory.ConfiguredOrderController().GetOrder(42); 

    The problem here is: what type is returned by ‘ConfiguredOrderController()’? Because it must have the static ‘GetOrder(int id)’ method — and static methods are not supported by inheritance or interfaces. The way around this is not to use static methods in the OrderController class.

    public interface IOrderController {     Order GetOrder(int Id) }  public class OrderController: IOrderController {     public Order GetOrder(int Id)     {} } 

    and

    public class OrderControllerFactory() {     public IOrderController ConfiguredOrderController()     {} } 

    Hence, you will probably be better off by using non-static methods for the controller.

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

Sidebar

Related Questions

Is there a way to determine the language in which an assembly was originally
i have a date/time field called MyDate. Originally, its format is mm/dd/yyyy and there
Is this code snippet poorly designed? Originally, there was only one AppDomain.Unload , in
Hello this code was not done by me originally and there are some thigns
I originally started a project in Visual C++ 2010, which was an empty/Blank project.
Originally I thought to ask if there would be an easy way to provide
I originally asked this question on RefactorMyCode , but got no responses there... Basically
i have several classes with members called 'Id'. Originally i wanted to store these
is there a way to setup an image as a device wallpaper? Originally I
I try to decrypt data that was originally encrypted with Objective-C in Java. There

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.