{"id":21042691,"url":"https://github.com/yugabytedb-samples/yugabyte-simple-csharp-app","last_synced_at":"2025-05-15T17:31:02.559Z","repository":{"id":69256373,"uuid":"457858283","full_name":"YugabyteDB-Samples/yugabyte-simple-csharp-app","owner":"YugabyteDB-Samples","description":"A simple C# application that connects to a YugabyteDB database cluster and performs basic CRUD operations.","archived":false,"fork":false,"pushed_at":"2024-07-16T16:32:03.000Z","size":200,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":66,"default_branch":"main","last_synced_at":"2024-07-16T20:26:54.100Z","etag":null,"topics":["demos"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YugabyteDB-Samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-10T16:27:31.000Z","updated_at":"2024-07-16T16:32:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"3cb54e45-eda9-49be-8956-def257e3074f","html_url":"https://github.com/YugabyteDB-Samples/yugabyte-simple-csharp-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugabyte-simple-csharp-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugabyte-simple-csharp-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugabyte-simple-csharp-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YugabyteDB-Samples%2Fyugabyte-simple-csharp-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YugabyteDB-Samples","download_url":"https://codeload.github.com/YugabyteDB-Samples/yugabyte-simple-csharp-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225365978,"owners_count":17462973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demos"],"created_at":"2024-11-19T14:08:40.998Z","updated_at":"2024-11-19T14:08:41.523Z","avatar_url":"https://github.com/YugabyteDB-Samples.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple C# Application for YugabyteDB\n\nThis application connects to your YugabyteDB instance via the \n[Npgsql](https://docs.yugabyte.com/latest/reference/drivers/ysql-client-drivers/#npgsql) driver for PostgreSQL and performs basic SQL operations. The instructions below are provided for [YugabyteDB Aeon](https://cloud.yugabyte.com/) deployments. \nIf you use a different type of deployment, then update the `sample-app.cs` file with proper connection parameters.\n\n## Prerequisites\n\n* [.NET 6.0 SDK](https://dotnet.microsoft.com/en-us/download) or later version.\n* Command line tool or your favourite IDE, such as Visual Studio Code.\n\n## Start YugabyteDB Aeon Cluster\n\n* [Start YugabyteDB Aeon](https://docs.yugabyte.com/latest/yugabyte-cloud/cloud-quickstart/qs-add/) instance. You can use\nthe free tier at no cost.\n* Add an IP address of your machine/laptop to the [IP allow list](https://docs.yugabyte.com/latest/yugabyte-cloud/cloud-secure-clusters/add-connections/#manage-ip-allow-lists)\n\n## Clone Application Repository\n\nClone the repository and change dirs into it:\n\n```bash\ngit clone https://github.com/YugabyteDB-Samples/yugabyte-simple-csharp-app.git \u0026\u0026 cd yugabyte-simple-csharp-app\n```\n\n## Provide Cluster Connection Parameters\n\nLocate and define the following connection parameters in the `sample-app.cs` file:\n* `urlBuilder.Host` - the hostname of your instance.\n* `urlBuilder.Username` - the username for your instance.\n* `urlBuilder.Password` - the database password.\n* `urlBuilder.SslMode`  - make sure it's set to `SslMode.VerifyFull`.\n* `urlBuilder.RootCertificate` - a full path to your CA root cert (for example, `/Users/dmagda/certificates/root.crt`). \n\nNote, you can easily find all the settings on the YugabyteDB Aeon dashboard:\n\n![image](resources/cloud_app_settings.png)\n\n## Run the Application\n \nBuild and run the application:\n```bash\ndotnet run\n```\n\nUpon successful execution, you will see output similar to the following:\n\n```bash\n\u003e\u003e\u003e\u003e Connecting to YugabyteDB!\n\u003e\u003e\u003e\u003e Successfully connected to YugabyteDB!\n\u003e\u003e\u003e\u003e Successfully created table DemoAccount.\n\u003e\u003e\u003e\u003e Selecting accounts:\nname = Jessica, age = 28, country = USA, balance = 10000\nname = John, age = 28, country = Canada, balance = 9000\n\u003e\u003e\u003e\u003e Transferred 800 between accounts\n\u003e\u003e\u003e\u003e Selecting accounts:\nname = Jessica, age = 28, country = USA, balance = 9200\nname = John, age = 28, country = Canada, balance = 9800\n```\n\n## Explore Application Logic\n\nCongrats! You've successfully executed a simple C# app that works with YugabyteDB.\n\nNow, explore the source code of `sample-app.cs`:\n1. `connect` function - establishes a connection with your cloud instance via the Npgsql driver.\n2. `createDatabase` function - creates a table and populates it with sample data.\n3. `selectAccounts` function - queries the data with SQL `SELECT` statements.\n4. `transferMoneyBetweenAccounts` function - updates records consistently with distributed transactions.\n\n## Questions or Issues?\n\nHaving issues running this application or want to learn more from Yugabyte experts?\n\nJoin [our Slack channel](https://communityinviter.com/apps/yugabyte-db/register),\nor raise a question on StackOverflow and tag the question with `yugabytedb`!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugabytedb-samples%2Fyugabyte-simple-csharp-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyugabytedb-samples%2Fyugabyte-simple-csharp-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugabytedb-samples%2Fyugabyte-simple-csharp-app/lists"}