Newbie Q about base classes and where to put them

G

google

Struggling a bit with some newbie questions regarding base classes,
header files and the like in ASP.NET/C#.

(Using VS2005, C# and ASP.NET 2, and new to them all...)

I'm going to be creating about 200 web services that will share some
similar features. I want to abstract out this common functionality
into a baseclass and inherit from that. So far, so good. If I put the
base class in the App_Code directory for a single web service then all
is fine. But I want to use the same base class in my other web
services.

My questions

1. Can I use a base class that is accessible to all my web services?
If I can then where do I put it and how do I refer to it in VS?

2. MUST my baseclass stuff go into a pre-compiled DLL?

3. Can I do compile time '#includes' or equivalent?

Thanks...

(Please reply to the group as the email address I use to post gets too
much spam...)

Steve
 
E

Eliyahu Goldin

Steve,

1. You should create a class library project and put the classes there. Then
you can add the same project to multiple solutions.

2. The project will compile into a dll.

3. You will need to add a reference to that project to other projects that
will use it.
 
G

google

Thanks for the quick response, Eliyahu...

(remember I'm using VS2005..)

I've set up a DLL and placed it elsewhere on my file-system (ie NOT
under my web services directory) and added a Reference to it. I notice
that a copy of that 'master' DLL is then made in a \Bin folder.

What happens if I update my 'master' DLL? Will I need to 'recompile'
the web service?

Thanks

Steve

Eliyahu said:
Steve,

1. You should create a class library project and put the classes there. Then
you can add the same project to multiple solutions.

2. The project will compile into a dll.

3. You will need to add a reference to that project to other projects that
will use it.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Struggling a bit with some newbie questions regarding base classes,
header files and the like in ASP.NET/C#.

(Using VS2005, C# and ASP.NET 2, and new to them all...)

I'm going to be creating about 200 web services that will share some
similar features. I want to abstract out this common functionality
into a baseclass and inherit from that. So far, so good. If I put the
base class in the App_Code directory for a single web service then all
is fine. But I want to use the same base class in my other web
services.

My questions

1. Can I use a base class that is accessible to all my web services?
If I can then where do I put it and how do I refer to it in VS?

2. MUST my baseclass stuff go into a pre-compiled DLL?

3. Can I do compile time '#includes' or equivalent?

Thanks...

(Please reply to the group as the email address I use to post gets too
much spam...)

Steve
 
E

Eliyahu Goldin

The easiest way of avoiding assembly versioning confusion is to have the
class library project as a part of the web service solution. Every time when
the dll changes, you would rebuild the solution to. If it doesn't suit you,
learn more on assembly versioning.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Thanks for the quick response, Eliyahu...

(remember I'm using VS2005..)

I've set up a DLL and placed it elsewhere on my file-system (ie NOT
under my web services directory) and added a Reference to it. I notice
that a copy of that 'master' DLL is then made in a \Bin folder.

What happens if I update my 'master' DLL? Will I need to 'recompile'
the web service?

Thanks

Steve

Eliyahu said:
Steve,

1. You should create a class library project and put the classes there.
Then
you can add the same project to multiple solutions.

2. The project will compile into a dll.

3. You will need to add a reference to that project to other projects
that
will use it.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Struggling a bit with some newbie questions regarding base classes,
header files and the like in ASP.NET/C#.

(Using VS2005, C# and ASP.NET 2, and new to them all...)

I'm going to be creating about 200 web services that will share some
similar features. I want to abstract out this common functionality
into a baseclass and inherit from that. So far, so good. If I put the
base class in the App_Code directory for a single web service then all
is fine. But I want to use the same base class in my other web
services.

My questions

1. Can I use a base class that is accessible to all my web services?
If I can then where do I put it and how do I refer to it in VS?

2. MUST my baseclass stuff go into a pre-compiled DLL?

3. Can I do compile time '#includes' or equivalent?

Thanks...

(Please reply to the group as the email address I use to post gets too
much spam...)

Steve
 
G

google

Thanks - that roughly what I figured I'd need to do. Nice to have it
confirmed though!

Steve

Eliyahu said:
The easiest way of avoiding assembly versioning confusion is to have the
class library project as a part of the web service solution. Every time when
the dll changes, you would rebuild the solution to. If it doesn't suit you,
learn more on assembly versioning.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Thanks for the quick response, Eliyahu...

(remember I'm using VS2005..)

I've set up a DLL and placed it elsewhere on my file-system (ie NOT
under my web services directory) and added a Reference to it. I notice
that a copy of that 'master' DLL is then made in a \Bin folder.

What happens if I update my 'master' DLL? Will I need to 'recompile'
the web service?

Thanks

Steve

Eliyahu said:
Steve,

1. You should create a class library project and put the classes there.
Then
you can add the same project to multiple solutions.

2. The project will compile into a dll.

3. You will need to add a reference to that project to other projects
that
will use it.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Struggling a bit with some newbie questions regarding base classes,
header files and the like in ASP.NET/C#.

(Using VS2005, C# and ASP.NET 2, and new to them all...)

I'm going to be creating about 200 web services that will share some
similar features. I want to abstract out this common functionality
into a baseclass and inherit from that. So far, so good. If I put the
base class in the App_Code directory for a single web service then all
is fine. But I want to use the same base class in my other web
services.

My questions

1. Can I use a base class that is accessible to all my web services?
If I can then where do I put it and how do I refer to it in VS?

2. MUST my baseclass stuff go into a pre-compiled DLL?

3. Can I do compile time '#includes' or equivalent?

Thanks...

(Please reply to the group as the email address I use to post gets too
much spam...)

Steve
 

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

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top