An open API service indexing awesome lists of open source software.

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

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
```