I'm new to C# and I'm trying to connect to a DB preferably PostgreSQL (or do I must use MS SQL?). How do I do that in VSCode and Mac (using dnx CLI)?
Update There is an official guide to getting setup in OS X. It uses SQLite, but switching out providers shouldn't be too tough.
If you want to use VS Code, you need to setup your project using ASP.NET 5. See this guide for doing the initial project setup.
You can use
Npgsql.EntityFramework7 on OS X. To use these, add them to your
project.json file. Both are pre-release, unstable builds and require that you use their myget.org feeds. To do this, add a Nuget.config file to your project.
This is my Nuget.config file.
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://www.nuget.org/api/v2/" /> <add key="AspNextVNext" value="https://www.myget.org/F/aspnetvnext/api/v2" /> <add key="Npgsql" value="https://www.myget.org/F/npgsql-unstable/api/v2" /> </packageSources> </configuration>