I setup an object context like this:
public MyObjectContext(....) : this(contextName, new EntityConnection(connectionString))
The connection string is a connection string to an Oracle database. I use DevArt as a provider btw.
Everything works fine. I can use it to retrieve entities etc.
But then I wanted to do something with the underlying connection. I did something like:
(OracleConnection)((EntityConnection)context.Connection.StoreConnection)
Which gives me the following exception:
SystemInvalidCastException: [A]Devart.Data.Oracle.OracleConnection cannot be converted to [B]Devart.Data.Oracle.OracleConnection. .... Type A is from C:\Windows\....\6.60.283\.... Type B is from C:\DevDirectory\...\7.2.104.0
It seems that the ObjectContext uses an old version of the DLL. However if I check the references of my project I see a reference to the correct version 7.2.104.0. As I checked further the ObjectContext can still connect even if I have no reference at all in the Subproject where its class is.
How does it resolve the DLL it uses to connect?