1
WebsiteSetting
{
   public string Name  Age {get; set;} 
   public string Language {get;set}
   public int ActiveSeason {get;set}
   ......
   ......

}

I have a class like this.when web page initialized,I start this class for every loaded pages and send this values to other classes as parameter.

for example ;

Student class use ActiveSeason properties , other classes also use those values as parameter.

My First question ,what is the best way to do that.how I descrice this class,for example constant class or what. Second question ,Is there any easy way to do that.I mean passing the those parameters every queries make the code messy,and diffucult to read.

sakir
  • 3,391
  • 8
  • 34
  • 50

1 Answers1

1

If this data is needed for every page like you mention, then this sounds like a perfect candidate for a base class.

I would recommend creating a base class and having all of your pages/controllers inherit from that base class.

As an example, is my MVC applications I might build something like this:

SiteNameController : Controller {
    //Properties, constructor and all that good stuff goes here.
}

and then in my actual controller that I want to use I would create it like so:

HomeController : SiteNameController {

}

If you're using WebForms, the same logic still applies.

Justin Helgerson
  • 24,900
  • 17
  • 97
  • 124
  • I am using web form,getting data via bll.u advise me something like this,Student:WebsiteSetting: { public string Name Age {get; set;} public string Surname{get;set} public int ActiveSeason {get;set} ...... ...... } – sakir Jun 12 '13 at 21:06