Entity Framework Reusing Connection

Posted by LB on Stack Overflow See other posts from Stack Overflow or by LB
Published on 2010-04-09T15:02:44Z Indexed on 2010/04/09 15:13 UTC
Read the original article Hit count: 418

Filed under:
|

in a using block for a connection to the entities,

How am I to reuse the connection when calling another method?

so I have:

using (SampleEntities entities = new SampleEntities()) {
    entities.Connection.Open();
    SomeMethod();

    ...
}


void SomeMethod() {
   using (SampleEntities entities = new SampleEntities())
   {
      // I want to be able to use the existing connection before the method call, any ideas?
   }

}

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about c#