https://github.com/cockroachdb/example-app-dotnet-efcore
Simple CRUD application in dotnet using Entity Framework Core
https://github.com/cockroachdb/example-app-dotnet-efcore
Last synced: 9 days ago
JSON representation
Simple CRUD application in dotnet using Entity Framework Core
- Host: GitHub
- URL: https://github.com/cockroachdb/example-app-dotnet-efcore
- Owner: cockroachdb
- Created: 2024-02-01T15:01:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-01T18:23:40.000Z (over 1 year ago)
- Last Synced: 2025-06-13T14:02:32.107Z (13 days ago)
- Language: C#
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 50
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# example-app-dotnet-efcore
A simple example of using CockroachDB with EntityFramework Core and the Npgsql driver.
### Preparation
Add the database URL to the environment variable
``` sh
# For a local, insecure database:
export DATABASE_URL="Host=localhost;Port=26257;Database=defaultdb;Username=root"# For a remote, secure database:
export DATABASE_URL="Server=HOST;Port=26257;Database=defaultdb;Userid=USER;Password=PASSWORD;SslMode=Require;"
```Run migrations
``` sh
dotnet tool install --global dotnet-ef
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet ef migrations add InitialCreate
dotnet ef database update
```Run app
``` sh
dotnet run
```