{"id":44355,"date":"2016-08-22T19:08:03","date_gmt":"2016-08-22T16:08:03","guid":{"rendered":"https:\/\/www.altoros.com\/blog\/?p=44355"},"modified":"2019-06-19T17:29:59","modified_gmt":"2019-06-19T14:29:59","slug":"using-the-postgresql-service-in-an-asp-net-app-on-ge-predix","status":"publish","type":"post","link":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/","title":{"rendered":"Using the PostgreSQL Service from an ASP.NET App on GE&#8217;s Predix"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-predix-postgresql-service-in-asp-net-app-v2.png\" alt=\"using-predix-postgresql-service-in-asp-net-app-v2\" width=\"200\" style=\"margin: 0px 0px 0px 20px;\" class=\"alignright size-full wp-image-44356\" \/><\/p>\n<p>PostgreSQL is one of the data management services available for applications running on the <a href=\"https:\/\/www.altoros.com\/blog\/tag\/predix\/\">Predix<\/a> platform. Here, you will learn about accessing and managing a PostgreSQL database instance hosted on Cloud Foundry.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#Preparing_the_application_for_Predix\" >Preparing the application for Predix<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#Managing_PostgreSQL_on_Predix\" >Managing PostgreSQL on Predix<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#Further_reading\" >Further reading<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To follow the steps of this tutorial, you need:<\/p>\n<ul>\n<li>a <a href=\"https:\/\/login.system.aws-usw02-pr.ice.predix.io\/login\" target=\"_blank\" rel=\"noopener noreferrer\">Predix account<\/a><\/li>\n<li>Microsoft Visual Studio 2015<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-net-core-1-0\/\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft .NET Core 1.0<\/a><\/li>\n<li>the <a href=\"https:\/\/github.com\/cloudfoundry\/cli\" target=\"_blank\" rel=\"noopener noreferrer\">Cloud Foundry CLI<\/a><\/li>\n<li>the Git CLI<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Preparing_the_application_for_Predix\"><\/span>Preparing the application for Predix<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To implement your ASP.NET application and make it ready for deployment to Predix, proceed with the following steps:<\/p>\n<ol>\n<li style=\"margin-bottom: 10px;\">Go to Microsoft Visual Studio 2015 and create a new project using a standard ASP.NET 5 template.<\/li>\n<li style=\"margin-bottom: 10px;\">Compile and start the application to check if it works locally.<\/li>\n<li>Create the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">AuthorsContext.cs<\/code> database context file.<\/li>\n<\/ol>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">public class AuthorsContext : DbContext\r\n{\r\n    public AuthorsContext(DbContextOptions&lt;AuthorsContext&gt; options)\r\n        : base(options)\r\n    { }\r\n\r\n    public DbSet&lt;Author&gt; Authors { get; set; }\r\n}<\/pre>\n<ol start=\"4\">\n<li>Add a simple <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">POCO<\/code> object.<\/li>\n<\/ol>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">public class Author\r\n{\r\n    public int Id { get; set; }\r\n    public string FirstName { get; set; }\r\n    public string LastName { get; set; }\r\n}<\/pre>\n<ol start=\"5\">\n<li>Additionally, create a controller with a self-explanatory action.<\/li>\n<\/ol>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">public class HomeController : Controller\r\n{\r\n    private readonly AuthorsContext _context;\r\n\r\n    public HomeController(AuthorsContext context)\r\n    {\r\n        _context = context;\r\n    }\r\n\r\n    public IActionResult Add(int id)\r\n    {\r\n        try\r\n      {\r\n          _context.Authors.Add(new Author()\r\n        {\r\n            Id = id,\r\n            FirstName = &quot;Eugene&quot;,\r\n            LastName = &quot;Lahansky&quot;\r\n        });\r\n        _context.SaveChanges();\r\n\r\n        var added = _context.Authors.FirstOrDefault(x =&gt; x.Id == id);\r\n        return new JsonResult(string.Format(&quot;Inserted author: {0} {1}&quot;, added.FirstName, added.LastName));\r\n      }\r\n      catch (Exception ex)\r\n      {\r\n          return new JsonResult(string.Format(&quot;Error: {0}\\r\\n {1}&quot;, ex.Message, ex.InnerException));\r\n      }\r\n    }\r\n}<\/pre>\n<ol start=\"6\">\n<li>Finally, configure the database context.<\/li>\n<\/ol>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">public void ConfigureServices(IServiceCollection services)\r\n{\r\n    services.AddMvc();\r\n    const string envName = &quot;VCAP_SERVICES&quot;;\r\n    var settings = Environment.GetEnvironmentVariable(envName);\r\n    var jSettings = JObject.Parse(settings);\r\n    var postgresCreds = jSettings&#x5B;&quot;postgres&quot;]&#x5B;0]&#x5B;&quot;credentials&quot;];\r\n    var username = postgresCreds&#x5B;&quot;username&quot;];\r\n    var password = postgresCreds&#x5B;&quot;password&quot;];\r\n    var host = postgresCreds&#x5B;&quot;host&quot;];\r\n    var port = postgresCreds&#x5B;&quot;port&quot;];\r\n    var database = postgresCreds&#x5B;&quot;database&quot;];\r\n\r\n    var connectionString = $&quot;User ID={username};Password={password};Server={host};Port={port};Database={database};Pooling=true;&quot;;\r\n    services.AddDbContext&lt;AuthorsContext&gt;(\r\n        opts =&gt; opts.UseNpgsql(connectionString)\r\n    );\r\n}<\/pre>\n<p>The application is now ready for pushing to Predix. To do this, run the following commands in your Command Prompt.<\/p>\n<ol>\n<li>\n<pre style=\"padding-left: 20px;\">cd &lt;<em>the folder where project.json is located<\/em>&gt;<\/pre>\n<\/li>\n<li>\n<pre style=\"padding-left: 20px;\">cf push testaspnetcore -b https:\/\/github.com\/cloudfoundry-community\/dotnet-core-buildpack<\/pre>\n<\/li>\n<\/ol>\n<p>If everything is done right, you will see something similar to what&#8217;s shown in the image below.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\" alt=\"using-ge-predix-postgre-sql-in-asp-net-core-app\" width=\"640\" class=\"aligncenter size-full wp-image-44357\" \/><\/a><\/p>\n<p>Next, create a <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">postgres<\/code> service instance and bind it to your application.<\/p>\n<ol>\n<li>\n<pre style=\"padding-left: 20px;\">cf create-service postgres shared-nr &lt;<em>postgres service instance name<\/em>&gt;<\/pre>\n<\/li>\n<li>\n<pre style=\"padding-left: 20px;\">cf bind-service &lt;<em>app name<\/em>&gt; &lt;<em>postgres service instance name<\/em>&gt;<\/pre>\n<\/li>\n<li>\n<pre style=\"padding-left: 20px;\">cf restage &lt;<em>app name<\/em>&gt;<\/pre>\n<\/li>\n<\/ol>\n<p>To add new authors to the database, you need to create a table. Note that you cannot access the Predix PostgreSQL database using, for example, <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">pgAdmin<\/code>. The database can be accessed only from applications deployed on Predix.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Managing_PostgreSQL_on_Predix\"><\/span>Managing PostgreSQL on Predix<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The easiest way to manage the PostgreSQL database is via using phpPgAdmin. We recommend to follow the instructions from the <a href=\"https:\/\/digitalsupport.ge.com\/CC_Home\" target=\"_blank\" rel=\"noopener noreferrer\">Predix Knowledge Base tutorial<\/a> explaining how to utilize the tool to access data in your Cloud Foundry\u2013hosted Postgres instance. Shortly, the steps are as follows:<\/p>\n<ol>\n<li style=\"margin-bottom: 10px;\">Open <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">cmd.exe<\/code> and create a directory for phpPgAdmin.<\/li>\n<li style=\"margin-bottom: 10px;\">Clone the following Git repository.<\/li>\n<pre style=\"padding-left: 20px;\">git clone https:\/\/github.com\/cloudfoundry-community\/phppgadmin-cf<\/pre>\n<li style=\"margin-bottom: 10px;\">Find the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">manifest.yml<\/code> file and update <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">name<\/code> with a unique value.<\/li>\n<\/ol>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">---\r\n#Generated manifest\r\napplications:\r\n- name: phppgadmin-cfready-devnet\r\n  memory: 1G\r\n  instances: 1<\/pre>\n<ol start=\"4\">\n<li style=\"margin-bottom: 10px;\">Push the application.<\/li>\n<pre style=\"padding-left: 20px;\">cf push<\/pre>\n<li style=\"margin-bottom: 10px;\">Bind your Postgres service to the phpPgAdmin application.<\/li>\n<pre style=\"padding-left: 20px;\">cf bind-service &lt;<em>phppgadmin app name<\/em>&gt; &lt;<em>postgres service instance name<\/em>&gt;<\/pre>\n<li style=\"margin-bottom: 10px;\">Restage the phpPgAdmin application.<\/li>\n<pre style=\"padding-left: 20px;\">cf restage &lt;<em>phppgadmin app name<\/em>&gt;<\/pre>\n<\/ol>\n<p>After these steps, open phpPgAdmin in the browser, where you can get full access to your PostgreSQL database.<\/p>\n<p><a href=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/managing-ge-predix-postgre-sql.png\"><img decoding=\"async\" src=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/managing-ge-predix-postgre-sql.png\" alt=\"managing-ge-predix-postgre-sql\" width=\"640\" class=\"aligncenter size-full wp-image-44358\" \/><\/a><\/p>\n<p>The source code for this tutorial is available in <a href=\"https:\/\/github.com\/Altoros\/Predix.Net-Postgres\" target=\"_blank\" rel=\"noopener noreferrer\">this GitHub repository<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Due to security reasons, Predix does not allow users to access the PostgreSQL database from outside. The only possible way is to manage the database from an application running on Predix.<\/p>\n<p>Furthermore, do not forget to read the <code style=\"color: #222222; background-color: #e6e6e6; padding: 1px 2px;\">VCAP_SERVICES<\/code> variable in your application. In this blog post, we have used the standard .NET method:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var settings = Environment.GetEnvironmentVariable(\u201cVCAP_SERVICES\u201d);<\/pre>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Further_reading\"><\/span>Further reading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/deploying-an-asp-net-application-to-ge-predix\/\">Deploying an ASP.NET Application to GE Predix<\/a><\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/how-to-get-started-with-asp-net-and-websocket-on-ge-predix\/\">How to Get Started with ASP.NET and WebSocket on GE Predix<\/a>\n<\/li>\n<li><a href=\"https:\/\/www.altoros.com\/blog\/introducing-a-one-click-button-for-deploying-to-ge-predix\/\">Introducing a One-Click Button for Deploying to GE Predix<\/a><\/li>\n<\/ul>\n<hr \/>\n<p><center><small>This post was written by <b>Eugene Lahansky<\/b> and <a href=\"https:\/\/www.altoros.com\/blog\/author\/viktoryia-fedzkovich\/\">Victoria Fedzkovich<\/a>.<\/small><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<\/p>\n<p>PostgreSQL is one of the data management services available for applications running on the Predix platform. Here, you will learn about accessing and managing a PostgreSQL database instance hosted on Cloud Foundry.<\/p>\n<p>&nbsp;<\/p>\n<p>Prerequisites<\/p>\n<p>To follow the steps of this tutorial, you need:<\/p>\n<p>a Predix account<br \/>\nMicrosoft Visual Studio 2015<br \/>\nMicrosoft .NET Core 1.0<br \/>\nthe Cloud Foundry [&#8230;]<\/p>\n","protected":false},"author":103,"featured_media":44357,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[214],"tags":[873,117,647],"class_list":["post-44355","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-cloud-native","tag-iot","tag-predix"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using the PostgreSQL Service from an ASP.NET App on GE&#039;s Predix | Altoros<\/title>\n<meta name=\"description\" content=\"In this tutorial, we will create and deploy a simple ASP.NET Core 1.0 application.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using the PostgreSQL Service from an ASP.NET App on GE&#039;s Predix | Altoros\" \/>\n<meta property=\"og:description\" content=\"PostgreSQL is one of the data management services available for applications running on the Predix platform. Here, you will learn about accessing and managing a PostgreSQL database instance hosted on Cloud Foundry. &nbsp; Prerequisites To follow the steps of this tutorial, you need: a Predix account Microsoft Visual Studio 2015 Microsoft .NET Core 1.0 the Cloud Foundry [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/\" \/>\n<meta property=\"og:site_name\" content=\"Altoros\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-22T16:08:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-19T14:29:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\" \/>\n\t<meta property=\"og:image:width\" content=\"833\" \/>\n\t<meta property=\"og:image:height\" content=\"488\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Eugene Lahansky\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eugene Lahansky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/\"},\"author\":{\"name\":\"Eugene Lahansky\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/41eafcad445ed8378c19eaaf9612668d\"},\"headline\":\"Using the PostgreSQL Service from an ASP.NET App on GE&#8217;s Predix\",\"datePublished\":\"2016-08-22T16:08:03+00:00\",\"dateModified\":\"2019-06-19T14:29:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/\"},\"wordCount\":679,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\",\"keywords\":[\"Cloud-Native\",\"IoT\",\"Predix\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/\",\"name\":\"Using the PostgreSQL Service from an ASP.NET App on GE's Predix | Altoros\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\",\"datePublished\":\"2016-08-22T16:08:03+00:00\",\"dateModified\":\"2019-06-19T14:29:59+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/41eafcad445ed8378c19eaaf9612668d\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/using-ge-predix-postgre-sql-in-asp-net-core-app.png\",\"width\":833,\"height\":488},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using the PostgreSQL Service from an ASP.NET App on GE&#8217;s Predix\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/\",\"name\":\"Altoros\",\"description\":\"Insight\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/#\\\/schema\\\/person\\\/41eafcad445ed8378c19eaaf9612668d\",\"name\":\"Eugene Lahansky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Lahanskiy.Evgeniy.jpg\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Lahanskiy.Evgeniy.jpg\",\"contentUrl\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/Lahanskiy.Evgeniy.jpg\",\"caption\":\"Eugene Lahansky\"},\"description\":\"Eugene Lahansky is a Solutions Architect at Altoros. With his extensive experience in .NET programming, he designs and develops web-based software for Windows platforms. Eugene also works with the UNIX stack of technologies, including NGINX, Docker, and Node.js.\",\"url\":\"https:\\\/\\\/www.altoros.com\\\/blog\\\/author\\\/e-lahansky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using the PostgreSQL Service from an ASP.NET App on GE's Predix | Altoros","description":"In this tutorial, we will create and deploy a simple ASP.NET Core 1.0 application.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/","og_locale":"en_US","og_type":"article","og_title":"Using the PostgreSQL Service from an ASP.NET App on GE's Predix | Altoros","og_description":"PostgreSQL is one of the data management services available for applications running on the Predix platform. Here, you will learn about accessing and managing a PostgreSQL database instance hosted on Cloud Foundry. &nbsp; Prerequisites To follow the steps of this tutorial, you need: a Predix account Microsoft Visual Studio 2015 Microsoft .NET Core 1.0 the Cloud Foundry [...]","og_url":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/","og_site_name":"Altoros","article_published_time":"2016-08-22T16:08:03+00:00","article_modified_time":"2019-06-19T14:29:59+00:00","og_image":[{"width":833,"height":488,"url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png","type":"image\/png"}],"author":"Eugene Lahansky","twitter_misc":{"Written by":"Eugene Lahansky","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#article","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/"},"author":{"name":"Eugene Lahansky","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/41eafcad445ed8378c19eaaf9612668d"},"headline":"Using the PostgreSQL Service from an ASP.NET App on GE&#8217;s Predix","datePublished":"2016-08-22T16:08:03+00:00","dateModified":"2019-06-19T14:29:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/"},"wordCount":679,"commentCount":0,"image":{"@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png","keywords":["Cloud-Native","IoT","Predix"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/","url":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/","name":"Using the PostgreSQL Service from an ASP.NET App on GE's Predix | Altoros","isPartOf":{"@id":"https:\/\/www.altoros.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#primaryimage"},"image":{"@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#primaryimage"},"thumbnailUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png","datePublished":"2016-08-22T16:08:03+00:00","dateModified":"2019-06-19T14:29:59+00:00","author":{"@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/41eafcad445ed8378c19eaaf9612668d"},"breadcrumb":{"@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#primaryimage","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2019\/06\/using-ge-predix-postgre-sql-in-asp-net-core-app.png","width":833,"height":488},{"@type":"BreadcrumbList","@id":"https:\/\/www.altoros.com\/blog\/using-the-postgresql-service-in-an-asp-net-app-on-ge-predix\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.altoros.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using the PostgreSQL Service from an ASP.NET App on GE&#8217;s Predix"}]},{"@type":"WebSite","@id":"https:\/\/www.altoros.com\/blog\/#website","url":"https:\/\/www.altoros.com\/blog\/","name":"Altoros","description":"Insight","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.altoros.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.altoros.com\/blog\/#\/schema\/person\/41eafcad445ed8378c19eaaf9612668d","name":"Eugene Lahansky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Lahanskiy.Evgeniy.jpg","url":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Lahanskiy.Evgeniy.jpg","contentUrl":"https:\/\/www.altoros.com\/blog\/wp-content\/uploads\/2016\/12\/Lahanskiy.Evgeniy.jpg","caption":"Eugene Lahansky"},"description":"Eugene Lahansky is a Solutions Architect at Altoros. With his extensive experience in .NET programming, he designs and develops web-based software for Windows platforms. Eugene also works with the UNIX stack of technologies, including NGINX, Docker, and Node.js.","url":"https:\/\/www.altoros.com\/blog\/author\/e-lahansky\/"}]}},"_links":{"self":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/users\/103"}],"replies":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/comments?post=44355"}],"version-history":[{"count":12,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44355\/revisions"}],"predecessor-version":[{"id":44379,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/posts\/44355\/revisions\/44379"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media\/44357"}],"wp:attachment":[{"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/media?parent=44355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/categories?post=44355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.altoros.com\/blog\/wp-json\/wp\/v2\/tags?post=44355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}