Code Organization Connundrum: Web Project With Multiple Supporting DLLs?
Posted
by Code Sherpa
on Stack Overflow
See other posts from Stack Overflow
or by Code Sherpa
Published on 2010-04-16T00:02:02Z
Indexed on
2010/04/16
0:43 UTC
Read the original article
Hit count: 317
Hi.
I am trying to get a handle on the best practice for code organization within my project. I have looked around on the internet for good examples and, so far, I have seen examples of a web project with one or multiple supporting class libraries that it references or a web project with sub-folders that follow its namespace conventions.
Assuming there is no right answer, this is what I currently have for code organization:
MyProjectWeb
This is my web site. I am referencing my class libraries here.
MyProject.DLL
As the base namespace, I am using this DLL for files that need to be generally consumable. For example, my class "Enums" that has all the enumerations in my project lives there. As does class MyProjectException for all exception handling.
MyProject.IO.DLL
This is a grouping of maybe 20 files that handle file upload and download (so far).
MyProject.Utilities.DLL
ALl my common classes and methods bunched up together in one generally consumable DLL. Each class follows a "XHelper" convention such as "SqlHelper, AuthHelper, SerializationHelper, and so on...
MyProject.Web.DLL
I am using this DLL as the main client interface. Right now, the majority of class files here are:
1) properties (such as School, Location, Account, Posts) 2) authorization stuff ( such as custom membership, custom role, & custom profile providers)
My question is simply - does this seem logical?
Also, how do I avoid having to cross reference DLLs from one project library to the next? For example, MyProject.Web.DLL uses code from MyProject.Utilities.DLL and MyProject.Utilities.DLL uses code from MyProject.DLL. Is this solved by clicking on properties and selecting "Dependencies"? I tried that but still don't seem to be accessing the namespaces of the assembly I have selected. Do I have to reference every assembly I need for each class library?
Responses appreciated and thanks for your patience.
© Stack Overflow or respective owner