Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/damienbod/AspNetCoreMultipleProject
ASP.NET Core API EF Core and Swagger
https://github.com/damienbod/AspNetCoreMultipleProject
asp-net-core aspnetcore ef-core ms-sql-server mysql postgresql sqlite
Last synced: 1 day ago
JSON representation
ASP.NET Core API EF Core and Swagger
- Host: GitHub
- URL: https://github.com/damienbod/AspNetCoreMultipleProject
- Owner: damienbod
- License: mit
- Created: 2016-01-06T12:28:31.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2022-12-08T14:54:45.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T14:41:02.956Z (15 days ago)
- Topics: asp-net-core, aspnetcore, ef-core, ms-sql-server, mysql, postgresql, sqlite
- Language: C#
- Homepage: http://damienbod.com/2016/01/07/experiments-with-entity-framework-7-and-asp-net-5-mvc-6/
- Size: 470 KB
- Stars: 226
- Watchers: 25
- Forks: 83
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ASP.NET Core API with Entity Framework Core and Swagger
[![.NET](https://github.com/damienbod/AspNetCoreMultipleProject/actions/workflows/dotnet.yml/badge.svg)](https://github.com/damienbod/AspNetCoreMultipleProject/actions/workflows/dotnet.yml)
Posts in this series:
- Experiments with Entity Framework Core and an ASP.NET Core API
- ASP.NET Core with PostgreSQL and Entity Framework Core
- ASP.NET Core with MySQL and Entity Framework Core
## History
2021-08-29 Updated to .NET Core 5.0
2020-11-08 Updated nuget packages
2020-10-10 Updated nuget packages
2020-01-10 Updated to .NET Core 3.1
2019-03-03 Updated NuGet packages
2018-12-04 Updated to .NET Core 2.2
2018-11-28 Updated to .NET Core 2.2 preview
2018-11-25 Updated NuGet packages, async everything, added swagger
2018-06-16 Updated to .NET Core 2.1
## Setup
### MS SQL Server
dotnet restore
dotnet ef migrations add microsoftSql --context DomainModelMsSqlServerContext
dotnet ef database update --context DomainModelMsSqlServerContext
-or-
Add-Migration "microsoftSql" -c DomainModelMsSqlServerContext
Update-Database -c DomainModelMsSqlServerContext
### SQLite
dotnet restore
dotnet ef migrations add sqliteMigration --context DomainModelSqliteContext
dotnet ef database update --context DomainModelSqliteContext
-or-
Add-Migration "sqliteMigration" -c DomainModelSqliteContext
Update-Database -c DomainModelSqliteContext
### PostGreSQL
dotnet restore
dotnet ef migrations add postgresqlMigration --context DomainModelPostgreSqlContext
dotnet ef database update --context DomainModelPostgreSqlContext
-or-
Add-Migration "postgresqlMigration" -c DomainModelPostgreSqlContext
Update-Database -c DomainModelPostgreSqlContext
### MySQL
dotnet restore
dotnet ef migrations add mySqlMigration --context DomainModelMySqlContext
dotnet ef database update --context DomainModelMySqlContext
-or-
Add-Migration "mySqlMigration" -c DomainModelMySqlContext
Update-Database -c DomainModelMySqlContext
## Testing
https://localhost:44388/api/dataeventrecords
Context-Type: application/json
```csharp
{
"DataEventRecordId":0,
"Name":"Funny data more",
"Description":"no",
"Timestamp":"2015-12-27T08:31:35Z",
"SourceInfo":
{
"SourceInfoId":0,
"Name":"Beauty",
"Description":"first Source",
"Timestamp":"2015-12-23T08:31:35+01:00",
},
"SourceInfoId": 0
}
```
or if a SourceInfo exists
```csharp
{
"DataEventRecordId":0,
"Name":"Funny data more",
"Description":"no",
"Timestamp":"2015-12-27T08:31:35Z",
"SourceInfoId": 1
}
```
### GET
http://localhost:44388/api/dataeventrecords
http://localhost:44388/api/SourceInfos