2

I am new to Postgres and I need help with connection string.

My app using Entity Framework. I have this connectionString to MSSQL Server:

<connectionStrings>
    <add name="DBContext" connectionString="Data Source=localhost;Initial Catalog=DB;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>

to my project i download a npgsql package (http://pgfoundry.org/projects/npgsql/) a need to help with editing connection string to Postgres database.

How to set providerName to npgsql?

Thank for help

3
  • 3
    Exactly what is the problem you are encountering? Commented Feb 24, 2014 at 18:05
  • I dont know how to set providerName to npgsql Commented Feb 24, 2014 at 18:09
  • I suggest you make this a part of the question. ;) Commented Feb 24, 2014 at 18:13

1 Answer 1

5

"don't hard code your providers" discusses this in detail.

It shows a setting like what you want:

<add name="blah" providerName="Npgsql" 
  connectionString="Server=127.0.0.1;Port=5432;Database=myDataBase;
    User Id=myUsername;Password=myPassword;"/>

but then explains why you should not do this, you should read the settings from your application's configuration file at runtime instead.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.