.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
ASPEvil
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Post New Web Links

c#/.NET 3.5 Producer/Consumer pattern using SQL Server

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :ASP.Net
 
Hello,I understand the producer consumer pattern but I'm finding it difficult to map it to using the Entity Data Model and SQL Server 2008. I want to implement a work queue where multiple threads will pick up the top 5 items (each) to work on and then perform somelong running task on each of those.I've googled for a an example of this but I can't seem to find one that uses the Entity Data model and C#Thanks for any tips.


View Complete Post


More Related Resource Links

SQL Server 2005: Regular Expressions Make Pattern Matching And Data Extraction Easier

  

Now you can perform efficient, sophisticated text analysis using regular expressions in SQL Server 2005.

David Banister

MSDN Magazine February 2007


Producer/Consumer using ThreadPool.RegisterWaitForSingleObject?

  
Hi, I'm trying to implement an abstract daemon class for a producer/consumer scenario using ThreadPool threads. I came up with: public abstract class ThreadPoolExecuter { private AutoResetEvent _Signal; private bool _IsStopped; protected bool IsStopped { get { return _IsStopped; } } public virtual void Start() { _Signal = new AutoResetEvent(false); ThreadPool.RegisterWaitForSingleObject(_Signal, new WaitOrTimerCallback(Signalled), null, -1, true); } protected void Signal() { _Signal.Set(); } void Signalled(object notUsed, bool timedOut) { if(_IsStopped) return; try { Execute(); } catch(Exception ex) { OnError(ex); } if(!_IsStopped) ThreadPool.RegisterWaitForSingleObject(_Signal, new WaitOrTimerCallback(Signalled), null, -1, true); } protected abstract void Execute(); protected abstract void OnError(Exception ex); } The idea is that different classes could inherit from this, and use their own Execute() implementation depending on their needs. The inheriting class would Signal() whenever it needed to execute some job on the ThreadPool. I have one such inheriting class implementing a Queue for a producer/consumer scenario. My problem is that sometimes my application (a web app hosted on IIS7) seems to miss events. No error is logged. This is obviously a very hazy description of the problem, so what I want to ask is this

SQL Server DateTime Convert pattern

  

I need the datetime to be in the following format for SQL server 2005

dd/MM/YYYY HH:MI in 24 Hour Format

note: seconds are not included

 

Thanks for any help in advance


Best Practices for Throttling DB Writes for Producer/Consumer Application

  

Hi - I'm working on a producer/consumer problem, which ultimately writes the results to a database.  We use multiple threads at each phase of the processing, including multiple threads to write the results to our database in the final phase.

We find that as we run the application more aggressively to increase throughput, we eventually start to burden the sql server, and begin to have timeouts on the database writes.

I'm trying to figure out what is the correct pattern or best practice to apply here to throttle or back-off when the sql server is burdened.  I've spent quite a bit of time looking around on the internet, but I may not be phrasing the question correctly, as this must be a common issue.  While there are a number of performance optimizations we are considering, we feel that as the sql server is a shared resource, we'll have to consider that the machine will get busy, and we'll have to back off in some fashion.

When

WSRP Consumer Webpart in Sharepoint Server 2010

  

Hi ,

Do we have a WSRP Consumer Webpart in Sharepoint Server 2010 ? (i am aware it was available on MOSS).

I need to consume a WSRP web part (created on an external portal) in Sharepoint Server 2010.Would i need to create a custom wrapper for it in sharepoint ?

Please be specific in your response as i cant find appropriate content on the net.

Even better if you can provide references.

Thanks,

Sharat Menon


Sharat Menon Sharepoint Development

Dialogs and ViewModel - Using Tasks as a Pattern

  
The ViewModel/MVVM pattern continues to gain popularity, with a blog post showing up every so often, and with tweets and retweets popping up even more often :-). At the same time, there are some interesting topics beyond the core pattern that continue to fuel experimentation. A big one amongst those is how should applications use dialogs when using the view model pattern.

The crux of the problem is the desire to keep the view model independent of UI concerns, and ensure it can be tested in a standalone manner, but that often comes to odds when you want the view model to launch a dialog, and/or do some work after the dialog is closed.

Prototype Design Pattern in C#. Vb.NET

  
Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype

Adapter Design Pattern in C#, VB.NET

  
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.

Singleton Design Pattern in C#, Vb.NET

  
Ensure a class has only one instance and provide a global point of access to it.

The Decorator Pattern & Extension Methods

  
The decorator pattern provides a formal way to add new functionality to an existing type, without sub-classing. First question: What is wrong with classical inheritance? In and of itself, nothing is wrong with the good old Is-A relationship. It is very common to derive a new class from an existing base class in order to override a few virtual members, and add a pinch of new functionality.

Implementing Continuous Scrolling UI Pattern in ASP.NET

  
When you have numerous records to show, we have to resort to Paging. There is a better alternative to display voluminous data (especially read only data) while providing a better user experience & also making efficient use of server bandwidth - the Continuous Scrolling or Infinite Scrolling UI Pattern. Read on to know more about how to implement Continuous Scrolling UI Pattern in ASP.NET with a GridView.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

  
In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.


jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

  
If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend