get a connection using EF generated classes
Posted: Mon 08 Dec 2014 04:58
I can create a PgSqlConnection as follows:
But instead I'd like to re-use the Connection that is created as part of the Devart Entity Model I generated from my DB (and already has a connection-string defined).
Something like this:
However, this doesn't work because these types don't cast. Is there a way to get a connection using the generated classes?
Thanks,
Code: Select all
PgSqlConnection pgConnection = new PgSqlConnection();
pgConnection.Host = "192.168.1.6";
...
Something like this:
Code: Select all
using (var context = new iCModel.iCEntities())
{
PgSqlConnection pgConnection = (PgSqlConnection)context.Connection;
Thanks,