ADO.NET :: Linq To SQL - Handle Concurrency In Application
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
Similar Messages:
Jan 13, 2011
I have the following problem:- I have a Settings table which has a value column, that is incremented everytime a Job is created (I use Entity framework to add the job and to update the value increment). So, I have something like this:
[Code]....
The problem is: I have a asp.net with concurrent calls to SaveJob Method. In this code, the value is shared, and if I call SaveJob 5 times for instance, the value column is 3, because the scope is not "locking" the other transactions until It's done, and the value is shared. I want to have the following scenario: Call SaveJob 5 times;Value column in Settings table is 5;Call SaveJob 3 more times;Value Column in Settings table is 8. I tried to implement something like pessimistic concurrency in EF, but I had no success. Whats the best way to handle that without using SQL Server queries directly? (like 'lock' and 'unlock' etc)
View 3 Replies
Jun 1, 2010
I've been quite impressed with dynamic data and how easy and quick it is to get a simple site up and running. I'm planning on using it for a simple internal HR admin site for registering people's skills/degrees/etc.
I've been watching the intro videos at www.asp.net/dynamicdata and one thing they never mention is how to handle concurrency control.
It seems that DD does not handle it right out of the box (unless there is some setting I haven't seen) as I manually generated a change conflict exception and the app failed without any user friendly message.
Anybody know if DD handles it out of the box? Or do you have to somehow build it into the site?
View 5 Replies
Mar 25, 2010
I have an application, that is accessing by number of users at the same time. Those users, who are accessing the application getting the same id. Here what i am doing in the code is, when they are creating new user i am getting a max id from DB and increasing the value to 1. So that they are getting same ID. so that i am facing concurrency in this situation. How to solve this problem. I need to display different numbers when the users click on NewUser. I am using SQL server 2008 and .NET 3.5 and C#.NET
View 2 Replies
Aug 30, 2010
My project includes a grid view with some updtable fields, some fields throw an error on update and some do not and it does not really make sense. WORK_STATION_ID does not cause an error, ROOM _ID cause an error, both are int? (I am using c#) and for update I use the code liste below.
[Code]....
[Code]....
View 1 Replies
Mar 29, 2010
I added a column of type "timestamp" to a table in SQL Server to use for concurrency control. I deleted all my tables from the Linq surface and then added them back. I see that the "Time Stamp" attribute is set to True for the timestamp column and False for all the other columns. I also see that the "Update Check" attribute is set to Never for all columns, including the timestamp column.
After watching some demo videos and reading some tutorials, I had expected to have to manually set the "Update Check" attribute values on the columns - to Never for all columns but the timestamnp column where it should be set to Always. But, before setting the "Update Check" to Always on the timestamp column, I decided to test it the way it was, and Linq seems to be doing the right thing - it seems to be using the timestamp column for concurrency control correctly even with "Update Check" set to Never on the timestamp column.
So my question is - does the fact that "Time Stamp" is set to True trump the "Update Check"? Or is there any other reason one could or should set "Update Check" to Always on a timestamp column? Is there any change in behavior?
View 2 Replies
Mar 9, 2010
I know that ASP.NET MVC has error filter attribute to handle specified error type. However, this feature cannot catch any error that occurs when application start. Therefore, I need to add some code to "Application_Error" method for handling this error like the following code.
public void Application_Error(object sender, EventArgs e)
{// At this point we have information about the error
var ctx = HttpContext.Current;
var exception = ctx.Server.GetLastError();
[code]...
View 1 Replies
Aug 27, 2010
I am converting my datatable to LISt using LINQ how do I handle nulls coming from database
List<Port> portDetails = new List<Port>();
DataTable dt = ds.Tables[0];
portDetails = (from q in dt.AsEnumerable()
select new Port
{
PortCode = q.Field<string>("Code"),
ExtCode = q.Field<string>("Nb"),
Name = q.Field<string>("Name"))
}).ToList();
In the above query if Code is null I do not want property portcode to be set to the value it should only set if it is not null or not blank
PortCode = q.Field<string>("Code"),
What should be syntax
I was trying somethign like this which doesnt work
Portcode = q.Field<bool>("Code") == null ? null : q.Field<bool>("Code")
View 1 Replies
Jun 28, 2010
Both the Method 1 and Method 2 can handle the paging of GridView, could you tell me how about the performance of the Method 1?and how much will Method 1 slower than Method 2
#region ForPaging
public static List<HD_ToDoList> Get_ToDoListByUserNameForPage(string username, int StartIndex, int PageSize)
{
[code]...
View 3 Replies
Jan 6, 2010
Recently I was working on displaying workflow diagram images in our web application. I managed to use the rehosted WF designer and create images on-the-fly on the server, but imagining how large the workflow diagrams can very quickly become, I wanted to give a better user experience by using some ajax control for displaying images that would support zoom & pan functionality.
I happened to come across the website of seadragon, which seems to be just an amazing piece of work that I could use. There is just one disadvantage - in order to use their library for generating deep zoom versions of images I have to use the file structure on a server. Because of the temporary nature of the images I am using (workflow diagrams with progress indicators), it is important to not only be able to create such images but also to get rid of them after some time.
Now the question is how can I best ensure that the temporary image files and the folder hierarchy can be created on a server (ASP.NET web app), and later cleaned up. I was thinking of using the cache functionality and by the expiration of the cache item delete the corresponding image folder hierarchy, or simply in the Application_Start and Application_End of Global.asax delete the content of the whole temporary folder, but I'm not really sure whether this is a good idea and whether there are some security restrictions or file-system-related troubles. What do you think ?
View 3 Replies
Jan 20, 2010
Almost all the applications I worked on involve some look-up values. For example, a lot of times a list of languages ( English, French, etc...) need to be displayed on the WebForm for user to choose.
The common data structure for such look up values include an integer Id and a string as name. Since these look-up values are used so frequently, and they are unlikely to be changed. Most of time, instead of grabbing them from database, I just define a global enum in C# like this
enum Language : int { English = 1, French = 2}
I've been handling look-up values like this for years now. I knew it may not be the best way to handle them. For example, every time a new language is added to the system, somebody needs to remember to update that enum.
View 3 Replies
May 20, 2010
Hopefully this is the right place for this question. I have done a fair amount of research and yet to find anything that matches what I want. What I'm envisioning is the following. Let me know if any of you know of a program that will do what I want. Also it must be web-based anom user -> fills out form -> email gets sent to admin saying xyz has filled out form abc with links to approve/disapprove request.
admin can also login and edit form and resent results to original submitter. Also once the admin approves/disapproves request the original submitter gets an approve/disapprove email.
and you can search by date submitted, specific project/form, status of request(submitted, approved, disapproved). all on where I could find this? I started to look into drupal with workflows and actions but it just doesn't flow right for this
View 1 Replies
Sep 26, 2010
I have used Quartz.Net for queuing and sending emails from my application. I don't know how each scheduled job responds to application instance stopping, pausing or shutting down. The IJob interface has no method that can notify a running job about these events.My question is how can I handle these cases when they occur so that the job can exit while leaving the application and the data in a stable state?
View 1 Replies
Feb 25, 2011
I am building an intranet website. And I am still unsure of how to implement the security of the website. I am using ASP.NET MVC 3.
Anyone in the company can access the website. It is a recognition system where you can nominate an employee for an award. Currently I am not using any type of authentication. I have a roles table that contains roles and an association table that specifies which user contain what roles, these roles are mainly administrator-type roles. If a user does belong in these roles then he/she can still access various parts of the website.
Would I need to use the built-in membership for this? Or would I need to create a custom membership for this? We don't use a login page. If the user does not have roles to access a view then he/she is redirected to another page.
We use IIS to do our authentication. Is this the same as Windows authentication? I have the roles table used for authorisation.
View 2 Replies
Jul 16, 2010
I see there are 2 possible scenarios as to the session handling:
Open one single ISession per request. Open it at request start and close it at request end.Open one ISession per conceptual "unit of work". Many sessions are created for a request.
The approach #1 is the one I'm doing now. I'm a little bit worried about it because, although it works, it's a little bit difficult to debug. For instance, I have an object not being saved (even though I ordered it to) and I'm having trouble debugging since there's a LOT of things happening during a complete request life-cycle.
The approach #2 seems to be the standard best-practice (not sure about ASP.NET) and I'm sure it's pretty easier to debug. The problem I see is about inter-session communication. For instance: My Page class holds a reference to the User, which is a persistent object. Many of the operations receive the user as parameter. As the user belongs to a different session, I can't pass it as a parameter.
I'm biased to #2, but I don't know if it's the best practice, nor how to deal with cross-session object.
View 4 Replies
Jun 25, 2010
I am writing an asp.net HTTP module which needs to read configuration data once from a local file (say config.xml stored in application root directory) and then based on configuration perform some processing on incoming requests.
Since there is no Application_Start/Application_init hooking available in Asp.NET modules, what would be the best way to handle the scenario. I am trying to avoid reading configuration file each time a request comes. Ideally, I want to read the config file when application starts.
I need to code this in http module only and do not want to use Global.asax
View 5 Replies
Jul 2, 2010
I' am trying to write a aplication using a 3 Tier Model
Data Access Layer <--> Business Logic Layer <--> Presentation Layer
But now i am facing a problem, i need to Handle Transactions i already found a interesting article
[URL] but i have some doubts.
For example when i need to iterate to a Grid in the presentation Layer how will i Use the Transactions??
[Code]....
View 2 Replies
Sep 28, 2010
When setting up asp.net error handlers for things like 404 errors, it is more 'efficient' to do this in IIS, or handle it in the Global.asax Application_Error event? I know the latter will be called, and I want to log this information in a database, but should I then just return without any redirect and let IIS do the redirect, or would it be better to do a response.redirect inside application_error once we've logged it?
View 1 Replies
May 6, 2010
I'm developing IP Blacklisting HttpModule in asp .net application and I found one very annoying thing. Each request to the asp net page generates tens of "subrequests" to application resources like images, client side scripts, styles etc.
Now in my application I'm listing to the BeginRequest event and when it is fired I'm loading Dictionary with blacklisted IPs from application cache and check user's IP against it. I've made a simple log of what is actualy happening during each page view, here are the results:
[Code]....
As you see, one request to Login page causes BeginRequest to fire 18 times, there is 18 dictionary loads, 18 lookups etc. That's not the way I want it to be.
Is there any other event that is raised only once per each request? Where do you place the blacklisting mechanism in your applications? I know I can do it through ISAPI filter, but the catch is, this site is on the shared hosting and I'm not sure I can use it on their IIS. Also I'm not sure if ISAPI filter can access some piece of cache with this blacklist (I don't want to load it from DB on each request, that's obvious).
View 3 Replies
May 10, 2010
[code]....
this code give that solution.but if any one of the field have null(example:r.urrQuickLinkRights contain the NULL) then only it will throw error like Object reference not set to an instance of an object.
View 2 Replies
Jun 9, 2010
In our IIS (v 6.0) there is one classic ASP app deployed, which has around 35 concurrent users. Now, a new ASP.NET(3.5) app needs to be deployed on the same server which will have its own 50 concurrent users. In this scenario should we create a Application Pool for this new .net app? What are other recommendations for the IIS settings in future?
View 3 Replies
Aug 6, 2010
In what way is used optimistic concurrency?
I need to connect two tables together.
If you use optimistic concurrency at the same time, users will store data in a table?
In particular, I wonder what the difference is, if I save the aspx, or use optimistic concurrency.
View 1 Replies
Oct 20, 2010
I need to handle "session end" event for my web application when user closes his browser. Session is stored in Sql.
View 6 Replies
Oct 14, 2010
i have a hotle reservation system.
when a user select a room i want that it lockes and an other person can not select it.
i think it`s better that i have a flag in my table and when a user select room value of is false and if cancle reservation ,i changed it true.an other person can see room that they have true value .
View 7 Replies
Nov 23, 2010
I want to know how to handle the concurrency throughy code ? ie: I want to access the Concurrency issue or error ? Because if i get the concurrency user or issue I have to do some manipulation.
View 4 Replies