473,378 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

DataAdapter Factory Synchronization ThreadSafe?

JDR
I am trying to implement an abstract query factory in .NET. My solution uses a Factory that creates a concrete command class using reflection and caches an instance of it in a HashTable. Each concrete command class uses the Data Access Application block SQLHelper to execute queries and return a typed dataset. The Factory then caches the DataSet using the Caching Application Block implementation of an in Memory cache. To call a query then, using the factory we would basically do the following

DataSet ds = Webservice.Execute(String queryname, DataSet Parameters)

The solution works well but when I hit is hard in testing with multiple threads I am having issues. The key classes involves are basically as follows: I would post a diagram if I could

Factory (regular createable object. Static hashtable that is synchroized for storing the references to created queries

CacheManager (Singleton implementation by MS) - Used to store datasets returned from calls to concrete queries

ConcreteQueries (created by reflection. Implement interface and return dataset. Utilize static field variables for tablemappings

SQLHelper (static filldatasetmethod is the only one I use) Utilized multiple times by each concrete query to get data from whereever and buildt he dataset.

I am having synchronization issues when I multithread this guy. Basically unless I synchronize my calls to the concrete queries, I get issues with the dataadapter complaining about 'Mapping for Table .... already exists'. Somehow, the DataAdapter must be retaining mappings from previous calls. I cannot put a sync block around this or performance will get killed by serializing my calls to the database.

Can anyone tell me if the SqlHelper is thread safe? How about the DataAdapter it is using? I know ADO must be stateful in it's implementation to allow for connection pooling etc but I cannot understand how it is retaining these mappings between calls.

Thank you.
Nov 16 '05 #1
0 1557

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason Morehouse | last post by:
Hello, Just wondering if anyone is using the apache worker module with php? I've complied php5 with zend threadsafe support, and apache2 with the MPM worker module on a Linux box. Everything...
0
by: Stephanie Stowe | last post by:
Hi. I have been posting like a looney on an issue I am working on. I will reiterate the background since you all do not want to remember my issues! I have an ASP app (biggish). We are creating...
2
by: Ryan Mitchley | last post by:
Hi all I have code for an object factory, heavily based on an article by Jim Hyslop (although I've made minor modifications). The factory was working fine using g++, but since switching to the...
9
by: John | last post by:
If a value type is immutable, I guess it's threadsafe to read it? But not threadsafe to assign a new value to it (can any value type be truely immutable? Isn't assigning a totally new value to it,...
4
by: scott | last post by:
hi all, Thx to any one that can offer me help, it will be much appreciated. iv got a multithreaded program and need to use thread synchronization. The synchronization does not have to...
2
by: David | last post by:
I have a static method in the dll that looks like this public static int myStaticFunction(int input){ } My question is, should I use a mutex inside the function to ensure that the function is...
3
by: Diffident | last post by:
Hello All, Following is a static method. Can you please tell me if this is threadsafe...why? If it is not threadsafe...why? Thank you. public static string...
2
by: Macca | last post by:
Hi, I need a data structure such as an Array/ArrayList/Generic List to hold multiple instances of a user derfined class. This array will be accessed across multiple threads. However I dont...
10
by: chrisben | last post by:
Hi, Here is the scenario. I have a list of IDs and there are multiple threads trying to add/remove/read from this list. I can do in C# 1. create Hashtable hList = Hashtable.Synchronized(new...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.