ASP.Net Classes

B

Big E

I'm using ASP.Net and SQL Server 2000.
There are many things in my ASP.Net application that I use over and over.
For instance my Connection to the database. I've stored that in the
webconfig. But how do I store other Functions or Variables throughout the
entire application. Classes? What is the difference between a Windows Forms
Class and a ASP.Net class. Do people use custom classes in ASP.Net.

If you have any links on creating ASP.Net classes please post.

Thanks.

Big E
 
K

Kevin Spencer

Nearly everything in .Net is a class. It would help to read up and
understand object-oriented principles in order to use any .Net technology
effectively. It's really not that complicated. Just hard to get your head
around initially, if you're used to procedural programming.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
B

Big E

I've created a couple classes for functions that I use across the
application but should I be created a class for all my DataSet, DataTables
etc... called clsData?
 
J

Joris Dobbelsteen

The best solution would be to develop a layer that handles everything that
is not displaying or formatting information on the actual web page and
cannot be handled by the database itself.

Doing so would be an option, if it suits your application. Don't make a
class to large, but rather keep them small. Multiple classes are easier to
handle that a single class containing everything, obviously depending on the
complexity.

I have a very small application where there is (currently) a single class
that handles getting information from either the ASP.NET cache or from the
database. The loading is located here, since many pages use the same
information. The actual query is a stored procedure in the MSSQL server.
The page only handles loading the data into Repeaters and setting HTTP cache
options (and allow Validation to work properly for the dynamic pages).

When you develop the middle layer correctly, then you can later replace the
web application by a windows forms application with very little trouble
(only rebuilding the UI).

Generally, take as less effort as you need for the application, but put some
in to make it a clean design.

- Joris
 
J

John Saunders

Big E said:
I've created a couple classes for functions that I use across the
application but should I be created a class for all my DataSet, DataTables
etc... called clsData?

No, the better solution would be to learn a bit about object-oriented
principles. You don't have to go learn OOA, OOD, Patterns and all the rest,
but you should learn what a class is, inheritance, etc. before you proceed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top