Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > c#:only put "using blah.blah.blah" once instead of every page?

Reply
Thread Tools

c#:only put "using blah.blah.blah" once instead of every page?

 
 
evolve
Guest
Posts: n/a
 
      10-30-2003
(in c#) does anyone know a way of having the "using" declaration just the
once

for example

in my website i keep having to put
using System.Data.SqlClient;

using System.Data;

using System.Configuration;





just so that i can get something out of the database

surely there is a way of having a bunch of global declarations?


--
#-)


 
Reply With Quote
 
 
 
 
Eric Cadwell
Guest
Posts: n/a
 
      10-30-2003
Sure - just put all your classes in the same file.

-Eric


 
Reply With Quote
 
 
 
 
William Ryan
Guest
Posts: n/a
 
      11-02-2003
Evolve:

If you are sticking System.Data.SqlClient over and over in your website,
that's more a function of your design than an inconvenience forced at the
behest of Visual Studio. Here's why I say that....

Let's say that you break up your project into presentation layer, a business
layer (which may iself be composed of muliple components) and a data access
layer. Ultimately at the back end you have a database that hosts its own
potential for logic.

The only way that you need to keep using libraries of Data in the
presentation layer is if you data functionality is tightly coupled with it.
You could easily declare a Datatable for instance, and let your DataLayer
pass data to and from it. Never on a form would you need a reference to SQL
Client or configuration.

You coudl also grab all of your configuration information non-related to
dataaccess and load them into Session Variables when the app starts. You
won't need to reference System.Configuration again (except if one of your
compnents needs it, but even this would only need to happen once per
component).

Now, for things like System.Collections and many such libraries, there
probably isn't a way to compleletey isolate it in one area b/c you need
collections all over the place. However, this is a relatively small problem
if you seperate everything into well grouped components.

HTH,

Bill
"evolve" <NOngnSPAMpeaSPAMrseNO_S__PAMhotmail.com> wrote in message
news:(E-Mail Removed)...
> (in c#) does anyone know a way of having the "using" declaration just the
> once
>
> for example
>
> in my website i keep having to put
> using System.Data.SqlClient;
>
> using System.Data;
>
> using System.Configuration;
>
>
>
>
>
> just so that i can get something out of the database
>
> surely there is a way of having a bunch of global declarations?
>
>
> --
> #-)
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Explorer.exe error report every time access every type of video me =?Utf-8?B?SXJ3YW5zeWFo?= ASP .Net 4 10-30-2007 07:49 AM
Beeps once every three minutes like clockwork colinplant Computer Support 9 08-09-2007 04:54 AM
Forms authentication - seems to log out every once in a while. Mufasa ASP .Net 2 06-04-2007 03:28 PM
Regex to match say char 't' exactly once in a string and no more than once Gancy Perl Misc 4 02-03-2005 02:19 PM
webapp restarting every once in a while? Flip ASP .Net 5 11-27-2004 06:48 PM



Advertisments