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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:46:58+00:00 2026-05-28T18:46:58+00:00

In a heavy enviroment application, we have Users, Locations, bla bla bla… and we

  • 0

In a heavy enviroment application, we have Users, Locations, bla bla bla… and we use in many situations a call to a service where we retrieve the list of countries.

Where is the ‘best practice’ or ‘proper way’ to implement this. This method is called in several places and many objects has a List<CountryVO> property.

Specially considering using Razor views an often having to add this property to ModelViews

The solution is using DAL / BLL / SERVICE / UI[s] architecture.

Real Example:

public class User {
...
...
public List<DeliveryZoneVO> DeliveryZones {get;set;}
    public User() {
    ...
        DeliveryZones = service.GetDeliveryZones().ToList();
    }
}

The class DeliveryZoneVO comes from a webservice, so one property is

int IdCountry

The class User have a list of DeliveryZoneVO as presented on the class, the ‘problem’ here, is since it retrieves the data from a web service, I only have the ID of the country.

When I prepare the data in the controller to send to the View:

UserModelView userMV = new UserModelView();
userMV.user = service.GetUserById(1);
ViewData.Model = userMV;

BUT, inside userMV.user, I have DeliveryZones with a list of DeliveryZoneVO objects with IdCountries.

In the view, when I do (for example) :

@DisplayFor(m => m.user.DeliveryZones)

I want to show the Country Name, only have the ID. So i need a reference somewhere.. the question lies in where should that data needs to be placed that is considered BEST PRACTICES.

Is having in all modelview (in the case of the example, the UserModelView() the property Countries with a List ?

  • 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-28T18:46:59+00:00Added an answer on May 28, 2026 at 6:46 pm

    A good thing because this kind of issues is to have a BaseController class that derived from controller, and all the other controllers you have derived from it.

    in the BaseController put a static List<CountryVO> property with getter only, this way it will be initialized once and will be accessible to all of your’s controllers and views(If you pass it with the ViewModel or ViewBag).


    Example:

    public class BaseController : Controller
    {
        private static List<CountryVO> _allCountries;
    
        public static List<CountryVO> AllCountries
        {
            get{ return _allCountries ?? _GetCountriesFromSomeWhere();}
        }       
    }
    
    public class HomeController : BaseController 
    {
        public ActionResult Index()
        {
            ViewBag.AllCountries  = this.AllCountries;          
            return View();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We make heavy use of multicasting messaging across many Linux servers on a LAN.
We have a web application running in a production enviroment and at some point
We're developing a data heavy modular web application stack with java but have little
I have the source for a large (>250 files) library that makes heavy use
We have a web application (quite a heavy-weight one) that does a whole bundle
What is the best windows environment to use while developing web application with heavy
I'm developing an application that makes heavy use of web services. I will be
My application makes heavy use of ListViews. I find that Landscape mode significantly hinders
I have an ajax heavy web-application built using PHP, jQuery. I am looking for
suppose i have many heavy control is on the page. as for example i

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.