views:

28

answers:

1

I've been tasked with porting/refactoring a Web Application Platform that we have from ASP.NET to MVC.NET. Ideally I could use all the existing platform's configurations to determine the properties of the site that is presented.

Is it RESTful to keep a SiteConfiguration object which contains all of our various page configuration data in the System.Web.Caching.Cache? There are a lot of settings that need to be loaded when the user acceses our site so it's inefficient for each user to have to load the same settings every time they access.

Some data the SiteConfiguration object contains is as follows and it determines what Master Page / site configuration / style / UserControls are available to the client,

    public string SiteTheme { get; set; }
    public string Region { private get; set; }
    public string DateFormat { get; set; }
    public string NumberFormat { get; set; }
    public int WrapperType { private get; set; }
    public string LabelFileName { get; set; }
    public LabelFile LabelFile { get; set; }

    // the following two are the heavy ones
    // PageConfiguration contains lots of configuration data for each panel on the page
    public IList<PageConfiguration> Pages { get; set; }

    // This contains all the configurations for the factsheets we produce
    public List<ConfiguredFactsheet> ConfiguredFactsheets { get; set; }

I was thinking of having a URL structure like this:

www.MySite1.com/PageTemplate/UserControl/

the domain determines the SiteConfiguration object that is created, where MySite1.com is SiteId = 1, MySite2.com is SiteId = 2. (and in turn, style, configurations for various pages, etc.)

PageTemplate is the View that will be rendered and simply defines a layout for where I'm going to inject the UserControls

Can somebody please tell me if I'm completely missing the RESTful point here? I'd like to refactor the platform into MVC because it's better to work in but I want to do it right but with a minimum of reinventing-the-wheel because otherwise it won't get approval. Any suggestions otherwise?

Edit: Areas?" Would it be a viable option to use ASP.NET MVC 2 Areas, where each Area represents a different site, complete with css, javascript, etc.?

Thanks

A: 

Setting this information in your cache is just fine but anytime your application recycles it will need to be reload which usually isn't a problem. I think this follows the model since each request is providing you with the info you need to pull from the cache since it is based on the requests domain and you don't really need to look it up in a DB or make a costly call to build it except for the first time.

You could also consider moving this data to your web.config file but I am assuming there is one site with many domains pointing to it that you want to customize?

Just make sure your indexing the cached data with the site it's associated with and accessing by that index because all domains pointing to one app will use only one cache.

Kelsey