Reputation: 2687
I am wondering if it's possible to use Entity Framework to scan a database and build an EDMX model in the following scenario:
(It's actually a PostgreSQL database and I'll probably use dotConnect, but I assume the principle is the same, and I'm asking a similar question on the devart forums.)
The database is secured with SSL and the administrator has provisioned access for a single IP address - the address of the machine that hosts my ASP.NET website.
Will it be theoretically possible to set up Visual Studio (on my dev machine) and the host machine in such a way that I'll be able to access this database with my dev machine? What will I need to set up on the host machine to allow it to be used as a proxy (I have full admin access to it)?
Without having tried anything, it seems like the only option is to install Visual Studio on the host machine, build the EDMX model there, and import it into my dev environment and create the actual database locally, but I only want to do this as a last resort.
Upvotes: 0
Views: 172
Reputation: 122032
dotConnect for PostgreSQL allows you to connect through a proxy. You can install a proxy server on a computer, which hosts your ASP.NET website and has access to the PostgreSQL database. You can connect to a database via this proxy server. For this you need to apply the following connection settings:
PgSqlConnection conn = new PgSqlConnection("host=<DATABASE HOST>;port=5434;uid=<USER ID>;pwd=<PASSWORD>");
conn.ProxyOptions.Host = "PROXY HOST";
conn.ProxyOptions.Port = 3128;
conn.ProxyOptions.User = "PROXY USER ID";
conn.ProxyOptions.Password = "PROXY PASSWORD";
dotConnect for PostgreSQL also can connect via SSL. For this you need to configure your server so that it supports SSL connections and apply the following connection settings:
conn.SslOptions.CACert = "D:\\Certificates Pg\\client\\root.crt";
conn.SslOptions.Cert = "D:\\Certificates Pg\\client\\client.crt";
conn.SslOptions.Key = "D:\\Certificates Pg\\client\\client.key";
conn.SslOptions.SslMode = SslMode.Require;
dotConnect for PostgreSQL allows creating SSL connection via proxy.
Upvotes: 1
Reputation: 28591
Just copy postgres tools and libraries to server machine (or install full postgres DB on it) and use pg_dump
to dump DB schema and/or data to a file.
Read this page
for the details about pg_dump
.
If you want schema only dump use --schema_only
key for pg_dump
.
Upvotes: 1