New Posts New Posts RSS Feed: EntityManager error
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Forum LockedEntityManager error

 Post Reply Post Reply
Author
alex.tiuca View Drop Down
Newbie
Newbie


Joined: 16-Feb-2012
Posts: 4
Post Options Post Options   Quote alex.tiuca Quote  Post ReplyReply Direct Link To This Post Topic: EntityManager error
    Posted: 24-Feb-2012 at 6:28am
I get this error and i don't know how to solve it. The error is thrown on this method:

public static List<TIPI_RECAPITI> GetTipiRecapiti()
        {
            var query = from q in dbContext.TIPI_RECAPITI
                        orderby q.ID ascending
                        select q;

            return query.ToList<TIPI_RECAPITI>();
        }   

An EntityManager can only execute on a single thread. This EntityManager is authorized to execute on the thread with id=’16’; the requested operation came from the thread with Id=‘12’.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 24-Feb-2012 at 2:59pm
Hi Alex,


What most likely happen is that the EM is created on another thread but is executing query on a different thread.
Back to Top
alex.tiuca View Drop Down
Newbie
Newbie


Joined: 16-Feb-2012
Posts: 4
Post Options Post Options   Quote alex.tiuca Quote  Post ReplyReply Direct Link To This Post Posted: 27-Feb-2012 at 3:01am
How can i execute queries on the same thread?
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 27-Feb-2012 at 8:07pm
Well, in general, if you're doing synchronous operations, they stay on the same thread. It's a different story if you're doing asynchronous operations.

If you can upload your project here, I can take a quick look and let you know what's wrong.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down