Monday, 15 February 2010

c# - Using a Singleton pattern to Linq to Sql Data Context -


I have some confusion in SQL in SQL. I am looking for a real reason,

"There is already an open data reader connected to this command which must be closed first

especially in the multitasking environment. Most people are saying that the reason for this is that the data reference thread is not

please see the following thread for best answer

But in my case , I am using another class call "A" which is in the singleton pattern The objective of this class is to provide data context objects in a single context. I keep the example of this class "A" as a global example in the derived class and a special example by calling the datacontax.

My question is,

Will my method call increase uncontrolled memory? Based on my understanding, Singleton will maintain an instance, as a static object. August My assumption is wrong, please give me a good explanation.

Note:

My method throws the same exception in the call, so I'm sure That is the same problem in this scenario.

Your approach will normally cause problems. Do not do this just like a datacontax is not intended to be a singleton.

Even if A is a singleton, then create a new DataContext code within the appropriate methods within A , A within a DataContext instead of being in the form of a variable. (You can also consider that A should actually be a singleton in the first place.)

No comments:

Post a Comment