.net - LINQ To SQL Web Application Best Practices
May 7, 2010
In my experience building web applications, I've always used a n-tier approach. A DAL that gets data from the db and populates the objects, and BLL that gets objects from the DAL and performs any business logic required on them, and the website that gets it's display data from the BLL.I've recently started learning LINQ, and most of the examples show the queries occurring right from the Web Application code-behinds(it's possible that I've only seen overly simplified examples). In the n-tier architectures, this was always seen as a big no-no.I'm a bit unsure of how to architect a new Web Application.
View 2 Replies
Similar Messages:
Jul 18, 2010
All too often I find myself being required to design pages that flow through a series of steps. 1) Select from a set of options. Submit.2) Populate a page with results. Make changes. Submit.3) Do something based on the previous results. Submit.4) Confirm previous actions. Submit.5) Goto 1.An ecommerce site with shopping cart would be a textbook example of this.Now, there are any number of ways to deal with this. My question is, what is the recommended way to do it in asp.net? In PHP or ISAPI I would just use standard html controls, get the post data and do stuff with it, each on a different page
View 3 Replies
Aug 17, 2010
best practices to be followed in deployment of asp.net web application & WCF service in IIS 7 regarding the IIS 7 configuration settings , Security setting, application access level settings..
View 2 Replies
Sep 6, 2010
I am starting to design my own CMS , and i want it to be modular to add more functionality later by me or by any other developer I put my eyes on joomla CMS (very popular ,robust and extensible) I want to make a CMS with asp.net to be just skeleton and all functions are done through components
Functions like :-
User management
Content Management ,editing and display etc.
My main idea is to let the skeleton to know from the query URL the required component and pass all other parameters to it and the component do the rest (parse parameters display results etc.)
the problem is how to achieve this how to call the component and and how to let it render its UI and pass it to the skeleton to put it in the appropriate place in the main site template
View 4 Replies
Apr 4, 2010
Is there a sample application to demonstrate best practices for Asp.Net? I am looking for something like SharpArch (for Asp.Net)?
View 1 Replies
Apr 8, 2010
I have to pass information from a desktop application to Web application and vice versa. What are the best practices that are regularly used? Currrently I'm using Asp.Net and a Winforms. To pass data to Web Site im creating a (POST) WebRequest and posting an xml to the siteTo pass data to Application im using .Net Remoting from Asp.ne(I'm using Winforms is an adminstration and monitoring application.)
View 4 Replies
Feb 15, 2010
We need to secure how our web application access our SQL 2008 database on our hosted server. Any pointers where this is covered in detail? We have the following questions:1. right now the network service account runs the application pool containing our application in IIS. Should we define a local windows user account to run this application in IIS 6? Should we switch to Windows authentication?
View 3 Replies
Mar 20, 2010
I'm trying to use linq to sql for my project (very short deadline), and I'm kind of in a bind. I don't know the best way to have a data context handy per request thread. I want something like a singleton class from which all my repository classes can access the current data context. However, singleton class is static and is not thread-safe and therefore not suitable for web apps. I want something that would create a data context at the beginning of the request and dispose of it along with the request
View 1 Replies
Apr 9, 2010
Will linq to sql work in an asp.net 2.0 web applicationJust realized the server doesnt' support asp.net 3.5 (no control over it
View 3 Replies
Jul 17, 2010
I am developing sample web application which use C#, and LINQ to SQL. The application is very very slow and it takes about 2 secs to navigate between pages. I have already used SQL Profiler and monitor the calls to the SQL server. All SQLs looks normal to me and their execution time is always about 1 or 2 millisecs.I tried the same application in another PC and it is the same. So, it is not because of my computer performance.
View 3 Replies
Dec 25, 2010
i want define connectionSreing in the web.config and then use it for DataContext ConnectionString. i do that : 1. i creat a class in App_Code :(MisaghDB is my database)
partial class MisaghDataContext
{
partial void OnCreated()
{
this.Connection.ConnectionString =
ConfigurationManager.ConnectionStrings["MisaghDBConnectionString"].ConnectionString;
}
// or
public partial class MisaghDataContext
{
public MisaghDataContext() : base (ConfigurationManager.ConnectionStrings["MisaghDBConnectionString"].ConnectionString)
{
OnCreated();
}
}
}
2. Add the connection string to my web.config file:
<configuration>
<connectionStrings>
<add name="MisaghDBConnectionString" connectionString="Data Source=NAZLIN-HP;Initial Catalog=MisaghDB;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
3. Right click on the DBML file design surface and chose properties. Select "none" for the Connection property.now should i change DBML file designer.cs (Misagh.designer.cs) ? The code should I delete in this file(DBMLfile designer.cs)? this is a part of my DBMLfile designer.cs :
[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="MisaghDB")]
public partial class MisaghDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
public NorthwindDataContext() :
base(global::WindowsFormsApplication2.Properties.Settings.Default.NorthwindConnectionString, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public NorthwindDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
............}
View 4 Replies
Aug 10, 2010
I am trying to handle concurrency in my application. Basically if user A has a support ticket open which currently has a status of 'Active' and user 'B' opens the same ticket and closes it (changing its status to closed), I would expect a confict execepton to be thown when user 'A' tries to close the support ticket. For some reason this is not happening. I have checked that Update check is set to 'Always' in the dbml file. Here is an exerpt of my code. // Update 'Active' lead to 'Close'
[Code]....
View 2 Replies
Dec 26, 2010
i am curious to know which is generic way to create DAL which can be used to large application and small applications using ?
1) What can i use to create large application Linq to Sql OR Entity Framework Or Any others ?
View 2 Replies
Jul 3, 2010
What is the common practice of input validation? In other words do you check for input validation on client-side, on server-side or on both sides?
Also, if performance is crucial to me, would just the client-side input validation be sufficient for my website without presenting any security risks?
View 6 Replies
Nov 24, 2010
I have a web application where users can upload the photo. I do have a windows service running which takes the uploaded photo and crops it to different sizes. This runs in a specified interval. Photo will be visible to the user once after it's cropped. So once user uploads the photo and photo cropper has not yet run, they wont be able to see the photo. Due to this behaviour user thinks that there was some error uploading the photo and they will upload it again and again.
where the photocropper runs immediately when the user uploads the photos which is queued.
I am using asp.net & C#.
View 3 Replies
Feb 11, 2011
I'm about to begin an ASP.NET MVC project and I'm not sure how to approach an aspect of the design. Basically, there is a user site and an admin site. In the admin sites, administartors design a form and send an e-mail link out to a handful of people. When the users click on the link, they are sent to the form.
Essentially what I'm wondering is what are the best practices when the model resembles looks more like a dictionary than a table?
In other words, instead of:
CREATE TABLE FormResponse (ResponseId, FormId, UserId, FirstName, LastName, BirthDay, Comments)
...containing 1 row per complete response
It's more like:
CREATE TABLE FormResponse (ResponseId, FormId, UserId, QuestionId, Value)
...containing 4 rows. 1 for the FirstName, 1 for the LastName, 1 for the BirthDay, and 1 for Comments.
View 2 Replies
Jan 29, 2010
I'm very new to MVC (just started 2 days ago), and I would like to know what the best practice is for outputing HTML.
I have a model named Tools.cs which contains the code below. It uses a stored procedure to return a recordset of menu items, and another to return a second level of menus for each first level menu. In another function, I then loop through the recordset and generate the HTML code to display the menu in a string, which is then returned.
I then have a controller MenuController.cs which calls the GetMenu method and puts the returned HTML string in the ViewData["RightMenu"].
I then have a view which displays the result.
My question is: would it be better practice to return my datareader to the controller into ViewData["RightMenu"], and then loop through it and construct my HTML in the View instead?How would I get that to work with that second level of menus?[Code]....
View 2 Replies
Feb 28, 2011
For WPF, there's the Microsoft Patterns & Practices's Prism project.
Prism provides guidance designed to you more easily design and build rich, flexible, and easy-to-maintain
Windows Presentation Foundation (WPF) desktop applications, Silverlight Rich Internet Applications (RIAs), and Windows Phone 7 applications I was wondering whether a similar project (reference implementation) intended for software developers building WCF applications exists.
In our main internal project (a .Net WinForms rich client app), we don't talk directly with the database but instead fetch and update data with ASP.Net web-services that we also control. Our current setup is giving us some bottlenecks. For a new smallish project, we want to try WCF. Objective question: Where do I find a not-too-basic WCF reference project?
View 2 Replies
Jul 4, 2010
We are working on a project which has lots of routes that can be changed on-the-fly or new routes can be added dynamically. What are the best practices about managing lots of routes and adding routes on-the-fly without recompiling? Reading-Writing from-to database or from Xml Document in Application_Start?
View 4 Replies
Feb 7, 2011
Here is the code of my Repository class:You see, I use singleton here. Also you see, there is a data context as class variable of Repository class.The main reason to use singleton here is a wish to avoid using 'using(NorthwindEntities context = new NorthwindEntities())' in every function.
[Code]....
This Repository is used in ASP.NET application. So only instance of NorthwindEntities (context) is used everywhere and that's why I never dispose it.So my question is: Won't this code cause connections to the DB that are not closed?
View 11 Replies
Apr 2, 2011
Possible Duplicate: Best practices for exception management in JAVA or C# I am using class libraries and I try to put maximum code in class libraries so that it can be reused in other projects.Please advice me where I should put try catch blocks in class library functions or in front end forms (aspx pages) ?
View 3 Replies
Feb 16, 2010
I am getting an exception like"NullReferenceException was unhandled by usercode-Object reference not set to an instance of an object." in (IEnumerable)Viewdata.Model.
<% foreach (EmployeeMaster m in (IEnumerable)ViewData.Model)
View 3 Replies
Apr 1, 2010
is it good for desktop application (WCF) or web application.I am little confuse about LINQ functionalities i have read some articles which are discourage LINQ (due to poor performance) for web applica
View 3 Replies
Apr 1, 2010
I have question about N-tier architecture. everyone about 3-Layer architecture these are:
1). UI Layer,
2). Business Layer,
3). Data Access Layer.
i already have worked on this.
Then i heard about LINQ to sql. how many layer an web application should contain.
As my knowledge. if i use LINQ to slq then i have to worked only 2-Layer:
- Data Acess/Business Layer: which contains only *.dbml files which is my database and
- UI Layer: which contains *.aspx files.
View 3 Replies
Jan 25, 2010
I would like to know what are the best practices in using Javascript in ASP.NET in a pre-AJAX and pre-jQuery era. What I meant by pre-era is not the time before AJAX/jQuery was created, but rather the time before it is popularized and widely adopted (by a significantly large number of programmers).i.e. Is it good thing to store the script in a string variable and register it on demand (RegisterClientScriptBlock) or on startup (RegisterStartUpScript)?Although in using Javascript in ASP.NET, its usage in PHP and JSP are also welcome.
View 1 Replies