Created
May 23, 2016 18:35
-
-
Save bertt/b61b014c72c5a94b39c2d30497ba7f37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sample .NET Core + Npgsql for RC2 | |
1] Project.json | |
{ | |
"buildOptions": { | |
"emitEntryPoint": true | |
}, | |
"dependencies": { | |
"Npgsql": "3.1.0" | |
}, | |
"frameworks": { | |
"netcoreapp1.0": { | |
"dependencies": { | |
"Microsoft.NETCore.App": { | |
"version": "1.0.0-rc2-3002673", | |
"type": "platform" | |
} | |
} | |
} | |
} | |
} | |
2] Program.cs: | |
using System; | |
using Npgsql; | |
namespace ConsoleApp1 | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var connString = "Server=192.168.99.100;User Id=pipeline;Password=pipeline;Database=pipeline"; | |
var conn = new NpgsqlConnection {ConnectionString = connString}; | |
conn.Open(); | |
var sql = "select count(*) from wiki_stats_mrel"; | |
var cmd = conn.CreateCommand(); | |
cmd.CommandText = sql; | |
var count = cmd.ExecuteScalar(); | |
Console.WriteLine("Count: " + count); | |
conn.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment