How To Organize Code Within An Application (sub Folders)

Jan 23, 2011

In a website, I see some developers put code into app_code, and sometimes appcode (due to some bug), other files into DataModel, and other files into miscellaneous folders.

Is there a standard approach to organizing code within an application?

How is it different between an ASP.NET, MVC, Silverlight, Console, Database, and WCF application? The reason I mention WCF is because many people seem to have a shared types library that is linked between the server and client code.

Where can I learn these common practices without having to try, fail, and try again. I'd rather just learn it once from the experts.

View 3 Replies


Similar Messages:

How To Create Folders To Organize Web Sites In IIS7

Apr 20, 2010

I have several ASP.NET sites in IIS7 and would like to be able to group them into folders (or other mechanism, if available). Ideally, I would use a customer name or account number and put the sites under there.

Is there a way to customize the organization of sites in IIS7, or is there just the one 'flat' view?

I'm open to tricks and hacks.

View 1 Replies

MVC :: How To Organize An Application

Apr 9, 2010

I'm building ASP.Net MVC 2 application using Repository pattern. My question is how to organize my application. Most of the examples I see on the web, using separate Modelproject with Repositories and Entity Data Model. These examples are not using MVC Model folder.

I have 3 projects in my solution.

1. Application (MVC Project)

- Models

- Repository (Here I want to create Repository folder for my Repository)

- IRepository (Also I want to create IRepository folder for my Interface)

2. DataModel ( Which will have my Entity Data Model and my POCO T4 Template)

3. Test

View 5 Replies

C# - How To Organize Code (methods I Create For Various Uses On My Website)

Oct 14, 2010

I wrote some code to connect the application to it's database, then I created some code to use the connection code and retrieve, update or add some values to the database, Also I might have some code to deal with other stuff than to deal with the database

The code is a little complicated, maybe it's simple but it's not short, for example to write a good piece of code to just retrieve a single value so I could set the controller with this value I used this :

SqlConnection sqlconnection= new SqlConnection(ConfigurationManager.ConnectionStrings["DefConnectionString"].ConnectionString);
SqlCommand sqlcommand = new SqlCommand("SELECT name FROM message WHERE id = 3", sqlconnection);
try
{
sqlconnection.Open();
lbl_name.Text = (string)sqlcommand.ExecuteScalar();
Status.Text = "Done";
}
catch (Exception ex)
{
Status.Text = ex.Message;
}
finally
{
sqlconnection.Close();
}

I might even add some code to store some info in the database about any exception is thrown, I think the code is pretty basic, yet it's not small, given that it's the smallest piece I'll need, some huge code is written for adding or editing new items, and also consider that it's not the only code I'll write in the page, the page has more needs.

I've provided a detailed case I hope!...So what do you think will be the best way to make my page fast and easy to read and have an organized code I've started placing every code in an appropriate method, but some methods are common so I create them again in every page that needs them like a ConnectionToDataBase Method, and mean while I think I just organized the page so I could mainly look at Page_Load and see what are the called methods and then scroll down to read the definition but It's still a big page and note the best practice I think

Sorry for all the big question, I just provide details so I could get a reasonable answer for my question, I hope everyone benefits from it as most questions are pretty basic, newbies like me needs some detailed cases and answers to get a better start.

EDIT: I know I'm new, So any comments on my code are more than welcome!

View 1 Replies

How To Organize Web Application Project In Visual Studio

Jan 31, 2011

+1 if you are specific to ASP.NET MVC projects.

Update 9:42 PM:

I am thinking about this from now as I need several developers across the globe to work on this project. We will be using VS 2010 and I heard some thing about web application templates.

View 2 Replies

Organize Code Outside The App_Code Directory Or Into Separate Projects?

Feb 25, 2011

I've been working with MVC for awhile and I'm not sure what works with asp.net.

Is it possible to organize code outside the App_Code directory or into separate projects? How would this be done?

View 2 Replies

Mixing Application Modules - Organize The Silverlight Project?

May 5, 2010

I work in a suite of ASP.NET applications that have several different "modules". The applications all share a main menu, so they all link to one-another. The modules are the high-level areas of the application. So, for example, it might be Payments, Orders, Customers, Products, etc. And Payments and Orders are in one app and Products and Customers are in another. Some of these menu links are "deep links", for example it might be a link to a particular page within the Customers module, such as Create New Customer.

We are about to start a project that will add several more modules to this suite, probably as a new .NET application. I'm thinking about doing these new modules in Silverlight (for various reasons that are not material to the question). If I were to do that, I need to make the menu look the same as the menu in ASP.NET, as the users still need to feel like they are inside one "application".

How should I organize the Silverlight project(s) so that I can "deep link" from ASP.NET pages into particular modules in the Silverlight app? What is even the best idea for creating these different Silverlight "modules"? If I had something that would've been a page in ASP.NET (for example - Create Customer), should each one of those be a separate Silverlight app? Or should it be a separate User Control? Or something else? Should I reuse our shared ASP.NET menu, and deep link to different Silverlight "modules" even within the new application? Or should I reimplement the menu in Silverlight for navigation within the app? Are there menu controls for Silverlight that look similar to ASP.NET menus (with flyout submenus in this case)? Could I maybe even share a SiteMap XML file between them?

View 1 Replies

How To Organize The Work After Project Needs To Be Re-implemented Due To Poor Code Quality

Apr 28, 2010

I have been asked to join a very small team where one main developer has been buiding the web app (.NET 4.0) during ~6 months. The project should be delivered within next 2 months.

After first look at the code I can say that I would never allow it to go to production (things like catch { }, no tests at all with WebForms etc).

So the code quality is incredibly low.

My task is to improve that and still deliver the solution. So I plan to start with unit testing and MVC2 reimplementing most of the functionality (though using some of the existing code).

I estimate that I will need about 6 weeks to catch up with the current progress and be on te same functionality level as the application will be in 6 weeks.

The problem is that the main developer who has been working on the project seems to be really starting in IT and many basic things are unknown to him. It will take significant amount of time and effort to educate him how to do the proper testing, development and apply some patterns.

I am ready to take responsibility for the reimplemnting the application but at the same time I don't want the main developer to be on idle but as he won't be able to significantly contribute to the better-world project at this stage I am not sure what would the best way to keep productivity high for both of us.

Currently I think following solution is good enough: He proceeds doing what he does until I will catch up with him and then start working on a new project together.

The problem is that of course this approach is not very productive as one developer will do better-world project while the other will proceed with what he did, effectively doing similar tasks.

Another approach would be to pair and try to do things together, but again not sure how productive we will be.

Can you suggest how we could better organise the work together in order to be most efficient for the overall project?

View 3 Replies

Listing Folders In Folders Then Creating Arrays In JS For Each Of The Folders?

Jun 21, 2010

Listing folders in folders then creating arrays in JS for each of the folders?

Directory Structure:

I have a directory structure as follows;

ad_folder
--folderA
--folderB
--folderC
--anotherFolder
--etcfolder
--afile.aspx
--anotherfile.gif
ad_code
--folderA
--folderB
--afile.aspx
--anotherfile.gif
ad_prep
--folderA
--etcfolder
--afile.aspx
--anotherfile.gif
ad_bin
--etcfolder
--afile.aspx
--anotherfile.gif
other Folder
files folder
assetsfolder
index.aspx
web.config
image.gif

Task at hand:

I want code in VB.NET to create javascript arrays of the folder contents that can then be used on the client end. I only need arrays for all folders contained in folders starting with ad_ and an array for all the base folders . like so:

var folders=["ad_folder","ad_code","ad_prep","ad_bin"];
var ad_folder=["folderA","folderB","folderC","anotherFolder","etcfolder"];
var ad_code=["folderA","folderB"];
var ad_prep=["folderA","etcfolder"];
var ad_bin=["etcfolder"];

note that I do not know the number of or the names of the folders, they can be different in different cases, I only have the root path.

[code]...

View 3 Replies

Use The Same Asp Code In Different Websites And Different Folders?

Mar 10, 2011

I got one remote website and two local websites. All the .asp files are the same in 3 websites. In the remote website, there is a file aaa.asp, its url is

http://www.xxx.com/aaa.asp

In the first local website, the url of the same file is
http://127.0.0.1/local1/aaa.asp

In the second local website, the url of the same file is
http://127.0.0.1/local2/aaa.asp

My question is: In any .asp files (may be in different folders) of any above website, how can I get the url of aaa.asp by use the same code?

View 3 Replies

Iis7 - Batch Create Asp.net Application Folders IIS 7?

Mar 10, 2011

We have a set of about 30-50 users who periodically need an ASP.net (version 4) application directory created for them.

As these numbers grow, manually creating an application directory for each user becomes cumbersome on IIS 7.

Is there a way to create these application folders using a batched/scripted/automated mechanism of some kind?

Ideally we'd like to provide input parameters of a file that contains a batch of application-names, and have the script automatically create the application directories in IIS.

View 3 Replies

How To Download Folders And Files From Server Where Application Is Deployed

Feb 1, 2011

i have some .txt files which are inside of different folders, i want to download all files and folder on client machine.

View 4 Replies

Configuration :: IIS 7.5 Application Pool Identity Account And Windows Folders?

Nov 1, 2010

"My application (ASP.NET) writes certain files in folders on my servers. In IIS 6.0 I used to give write access to IUSR account so that IIS can write to the folder. Now what I see is my application pool runs under App Pool Identity account. That is good but users are able to create files in the folders without App Pool Identity user being given specific permission to do so.

View 2 Replies

Forms Data Controls :: Write A Code For Displaying A Files And Folders Of Server Directory Using Grid View In .net?

Jun 12, 2010

how can we write a code for displaying a files and folders of server directory using Grid View in asp.net?

View 3 Replies

MVC :: How To Organize More Complex Routes

Mar 12, 2011

I understand the basics of setting up routes, I am trying to get a handle on how to organize more complex routes. Does the Route name do anything? I havn't seen a place it's actually used. If I have the route: controller/action/id/paramA/paramB/paramC. ParamA-C could be defining multiple parameters so First/Last/Zip or Phone/Zip/Birthday. Is it common practice to name the additional parameters with a generic name like paramA vs trying to differentiate a separate route for each?

Lastly, if you have multiple sites/functional areas in 1 site, lets say the asp.net site, each area MVC, Ajax, Forums ect were all different functional areas. Is it best to create a different group of routes such as hard coding the controller like:

MVC/action/id
Ajax/action/id
Forums/action/id

or is there a better way? What I am running into is 1 piece of the site overriding the other route because of the number/type of parameters.

View 5 Replies

C# - Name And Organize CLASS Files?

Nov 11, 2010

I use ASP.NET in C#, I am pretty new at developing so I would like have some advice from experts :-).uestions:What is the best ractice to organizing CLASS FILES?What kind of name do you use?For Web Application Project, how do you name NAMESPACE?In my Case I am building a simple CMS. I thought the FILE structure like this:

- AppCode
- Common
- UserDataInput.cs
- ExternalLibrary
[code]...

View 1 Replies

How To Organize And Manipulate Pictures In Filesystem

Aug 26, 2010

Although it may not seem like that but there is a little questions about this subject.I am not asking if I should use DB or filesystem, the file system it is, but I am asking what is the best way of organizing pictures in file system that will be used with asp.net application? I am talking about tens or even hundreds of thousands of picture.

To elaborate a question a bit.

Where should repository be located, create another VD in IIS or in application VD, or somewhere outside IIS?
How to organize file patsh, put them all in one folder or create subfolders. If so how to name all those folders?How to handle multiple sizes of the same image? where to locate them?How to sync folders and images with database?What else crosses your mind, and you think it's important..

I've done something myself allready, but I am asking if someone had some experience with this. Maybe it could be done better yours way.

I put things like this

I stored pictures in IIS folder, because storing them outside of iis make them unable to use in web, because of paths. You cannot use file path in web, it must be virtual file path.

http://images/1.jpg istead of C:images1.jpg
in the root I had subfolder for each picture size

root-
+400x300
+600x400
+1024x768

Named images by id from database. If the ImageID from database is 45678909, the name of picture is 45678909.jpg an it's location is

VDimages400x30045678945678909.jpg
VDimages600x40045678945678909.jpg

I sliced the picture name two by two, and create subfolders. the point was not to have more than 100 files in folder. Was this good idea or stupid one? How would you organize this? For person, this organization with tons of folder is not easy to use.

Name of the image with its relative path I saved in database table with description and time of insert etc. path: 45678945678909.jpg

View 2 Replies

MVC - How To Organize Commonly Used Drop-down Lists In Many Views

Jan 8, 2010

I am trying to understand how best to organize some common Dropdown lists used in several views (some are cascading)

Is it best to create a single ModelsCommonQueries then create a webservice for each dropdown used in cascading situation then have a single controller that contains actions for each dropdowns

This way I can follow DRY principle and not repeat the dropdown logics since they are used in various views.

View 1 Replies

Tool To Properly Organize Tag Attributes For Asp Files?

Jan 8, 2010

I realize that VS200X can ident asp files properly, however, for the sake of ease in finding attributes, is there a tool that will also organize the attribute order within a tag alphabetically? I'm always scanning around a tag visually and if the attributes were sorted alphabetically, asides maybe from ID and runat which should remain first, I would have a much easier time.

View 2 Replies

Jquery - Best Way To Organize Files In A Large MVC2 Project?

Jan 27, 2011

I've looked all over the web for the best way to organize an ASP.NET MVC2 project. I've only seen examples of people using the default template for MVC2 projects. But is this the best way to organize your project if it is going to contain a large number of files?

We're in the process of building an application that is heavily built around jQuery for UI and ajax using JSON. So, as you can imagine, we will have many custom .js support scripts.

In our solution, we have placed all our support libraries (3rd party and custom) into respective projects. The MVC2 project that is also in the solution is using the default MVC2 template.

In the MVC2 project, the "starting" structure is still pretty much unchanged. Under the Controllers directory, we have each controller AccountController.cs and HomeController.cs (for example). Under the Views directory, we have three subdirectories named Account, Home, and Shared. In the Scripts, directory we have also divided that up with three directories, Account, Home, and Shared. And finally we have the Models directory, that is also divided into Account, Home, and Shared subdirectories.

As you can see we haven't deviated from the basic template that much. But, as we start adding stuff to this, we're realizing how cumbersome this might become when we get upwards to 20 or 30 views and 100 support .js files.

View 1 Replies

Security :: Want To Organize Twenty-four-hour Local Network Monitoring?

Jun 16, 2010

I want to organize twenty-four-hour local network monitoring. Could you tell me about such program? The program has to ping hosts and save results in files on hard drive for viewing.

View 3 Replies

WebMatrix :: Use @foreach To Organize Limited Preview Rows And Displays The Page Number?

Mar 9, 2011

the helper @grid.GetHtml() You can display the limit rows (e.g. 10) and page numbers at the bottom of the display which can be viewed by clicking on the following sample data.But the helper @ grd.GetHtml() (I figured) there are restrictions in output. For example if I want to display picture < img src =" @ id .jpg" alt = ""/> (I'm doing when working with @ foreach) to do that I need to put in the < img src = ".jpg" alt = ""/> it's not convenient. mene Is it possible to use @foreach to organize limited preview rows and displays the page number to view the data?

[Code]....

View 2 Replies

Architecture :: How To Organize The Relationship Between Presentation Project And Web Project

Dec 27, 2010

When implementing MVP in a ASP.NET project, what are your preferences for how you organize the relationship between your presentation project and your web project?

View 1 Replies

Scramble Your C# Code From A Web Application And Still Have It Run Exactly The Same?

Nov 29, 2010

I was wondering if there is a way to protect asp.net front and backend code from being stollen.i.e.Is there a way to scramble your c# code from a web application and still have it run exactly the same?Any free ways of doing this?

View 3 Replies

How To Publish Web Application Without Code

Nov 12, 2011

How i can publish web application without code. I mean when i upload page it's be for example: Default.aspx , Default.aspx.cs , the user can download this pages and edit on code , what i need the user can't see the code after publish such .EXE

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved