Basic architecture question

M

mrpubnight

I was hoping someone with some experience can help me. I'm rather new
to .Net and OO programming. I'm trying to create an object model for a
project I'm working on and I'm somewhat confused how to go about
creating this using VS.Net.


I want to create a class structure that resembles the following - this
does not reflect the actual names, they are just for example:


Projects
Projects.Internal
Projects.Internal.Accounting
Projects.External.Extranet


Each of those items above should be separate classes however I would
like them all to compile into one .dll.


Currently in VS.Net, I've created one solution and then added each of
the above as a different project. This has left me with 4 separate
..dlls.


I would like to mimic something like System.Data where you load the
System.Data.dll library but with that you get SQLClient, etc...
Clearly SQLClient could have been compiled into it's own dll but it
resides within System.Data.dll.

Would it involve creating a base class, Projects, and then each
subsequent class inherits from that class, i.e. Internal, External.
Then Accounting and Extranet would inherit from these inherited classes
(Internal, External respectively). What if there is nothing to really
inherit? I'd like to use this type of namespace in hopes to keep
things organized and I'd like to have everything compile into a single
..dll. Like I said, I can create the schema I want by creating multiple
projects using the same naming convention and thus my namespace will be
defined a certain way but I don't feel that this is the 'correct'
manner in which to do things.
Can any point my in the right direction.

Thanks,
Frank
 
G

Guest

Each of the classes within a project can have their own namespace. This is
how it is achieved in the SYstem.Data example you provided.

Don't use inheritance if there is no shared logic or relationship between
your objects.

HTH
Dan
 
G

Guest

Each project in a solution compiles into a separate file. So you want to put
all your classes into one project in order to compile one DLL.

To address the classes with the "." notation you need to nest the classes,
which means putting them all in one file. The following empty class code will
create the name tree that you offered as an example:

Public Class Projects
Public Class Internal
Public Class Accounting
End Class
End Class
Public Class External
Public Class Extranet
End Class
End Class
End Class
 
G

Guest

I think the question here was "how do I set this up easily", which is most
easily accomplished through adding folders to the project.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

Following what you have written.

1. Create a Project called Projects
2. Create a folder in the project called Internal
3. Create folders in the Internal folder called Accounting and Extranet

When you create a class in the Extranet folder, it will have the namespace:

Projects.Internal.Extranet

There are ways you can dink this up, of course, but that is the default. The
whole will compile in one DLL.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Top