Entity Framework - the connection is closed - Asked By sangeetha vijayanandh on 04-Sep-12 05:44 AM

Hi All,

In my entity Framework, I received the following error

"the connection was not closed. the connection's current state is connecting. entity framework"

at this underlined point.


static class ProductLocationMapper


Convert from Business object to Presentation Model
public static IList<ProductLocationPM> ToPresentationModels(IEnumerable<Location> parms,bool isChild)


if (parms == null) return null;

return parms.Select(u => ToPresentationModel(u,isChild)).ToList();


In this same page , while clicking another view, the following error is coming.

"invalid operation. the connection is closed "

plx help me out.

Thanks i advance.

Rohan Dave replied to sangeetha vijayanandh on 04-Sep-12 02:53 PM
I believe the error is appearing becuase more than one thread at the same time trying to access your ProductLocationMapper class.

That's why it's throwing the error "the conection was not closed. the connections current state is connecting".

Do some logic or mechanism to lock the call of your static class by one thread only at a time...