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
Similar Messages:
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
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
Apr 21, 2010
Class file Conflicts in C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files is preventing me from building the solution. Even though I try emptying out the folder, each time Visual Studio starts the build process, it brings in the class file in to the temp folder with the same folder name. If I restart the machine or leave it overnight, project build without error. Is there anyway to tell Visual studio to delete/ignore/clean any lingering class files that could be in the temp folder?
Clean solution option in VS doesn't work either. Class file in conflict are from the App_Code folder.
View 4 Replies
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
Apr 16, 2010
I am working on a web project(asp.net with c#),In app_code there are 10 class files(.cs). I want to make only one DLL of these files. How can i do this.
View 6 Replies
Jan 23, 2011
I want have a web application that I am putting together - but I have started to see that some of the things I am writing are repeated over and over, example -
GetDepartments() in the code behind has all the database connections and is linked to a stored procedure.All it does is return Department Names' and Ids', ie then bind them to a dropdownlist.My question is this I have seen Class files - I want to know if I can put this type of information in there and just call it whereever I need it in the site and then bind to whichever dropdownlist I need to?I have had a look around the net and even saw some examples by scott mitchell - but it used datasets (.xsd) files etc and dont want to be using them, plus it was a little over my head. Does anyone know of some good simple examples out there that I can follow, or maybe some examples on here?
View 2 Replies
Apr 23, 2010
Is there anyway to actually have a class-file placed in any custom directory and still be able to compile it with the application?
View 4 Replies
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
Jan 20, 2010
i have 2 class file business logic layer in c sharp but my application is in vb.net ie my code (aspx.vb) file contains the code for th epage is it possible to reference the same csharp class files in the .aspx.vb file.
View 12 Replies
Oct 18, 2010
Using ASP.NET v3.5 / VS2008.
Is there a way to share class files across web site projects without actually making a physical copy of the file to the App_Code folder of each project?
View 9 Replies
Mar 14, 2011
I am new to Visual Studio 2010 and ASP.Net, and when I first connected my SQL Server to Visual Studio it created huge files full of my SQL classes (maybe this was LINQ classes), and I accidently deleted/corrupted those files, and now I want it to create those classes again. Can someone tell me how I can do that?
View 5 Replies
Sep 1, 2010
What is the recommended method of writing and storing class files in VS 2008, I'm using a web application?
View 2 Replies
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
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
Mar 2, 2010
I am tasked with customizing a third-party web application. Since the application is updated (ie new files are copied over the existing files) several times a year, I was hoping that I could put my custom code in separate files -- sort of like having asecond code-behind file for each page that is modified.
View 2 Replies
Feb 25, 2010
I have a single project. and I have two folder in it. In the 1st folder I have a class named Class1 and in the 2nd folder I have a class named Class2. Can anyone tell me how I can access members of Class1 in Class2. I have tried by adding namespace in Class1 and Using that namespace in Class2. But it is giving error. It is easy to access classes or their members from App_Code folder. I don't want to put my classes in app_code folder.
View 3 Replies
Feb 14, 2011
I was just wondering, let's say I created a Method that is in a partial class in App_Code, and this Method would replace the same type of Method that would otherwise be in many files, and so, since it would be called from many files and would probably be called and used very frequently especially because of this. Would this overload this class? I'm not saying what would most likely happen, I'm just asking if it would be even remotely possible?
View 2 Replies
Nov 9, 2010
I have a Web Site project running on VD2008, with an Access back end and .NET 3.5, C#.
I have created the project several times and added the usual App_Code, Pages, App_Data, Properties, folders. I created a Master Page and several content pages BUT I am unable to get to the folders or root where there is a Class (code) file.
I have tried all the usual lines...
using SumaCard.App_Code
OR
SumaCard.App_Code.FTP_Code ftpc = new SumaCard.App_Code.FTP_Code();
but nothing works? I have been hasseling over this for 2 days now.
What have I missed? Maybe I built the project wrongly? (Project | New Project | Visual C# | Web | ASP.NET Web Application |??
View 2 Replies
Jul 1, 2010
I am using LINQ to SQL with C#. Is there a method through which we can generate entity class files from the table schema? By dragging tables onto the graphical designer classes are generated but they are not the real class files(i mean actual files with the extension cs).
I am aware of that we can code the class files first and then create the schema manually or programmatically, but i wanted to know if the reverse is possible, may be using some third-party tools. I feel it will be very convenient to use LINQ that way.
View 3 Replies
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
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
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
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
Mar 15, 2011
I am not sure if this is a problem with visual studio, but I had some class files that I deleted, but I can still call them in my code. Also I can call a .edmx i created, but I cant see it in my folder, i tried rebuilding my solution, cleaning it, rerunning it, checking source files. Its also causing a lot of my classes to have this error:Missing partial modifier on declaration of type 'MatchGaming.Models.MyProfile'; another partial declaration of this type exists I already tried adding partial and it i just get a bunch of errors everywhere else saying that a lot of my variables already contain a definition, almost like theres a duplicate class stuck in the cache or something.
View 1 Replies