@@ -29,14 +29,16 @@ open `NuGet Package Manager` and add `MongoDB.Driver`
### File adaptations:
### File adaptations:
change version number in all files if a new version is provided
change version number in all files if a new version is provided
### - folder `Controllers`:
### folder `Controllers`:
change "`public class`" to "`public abstract class`"
change "`public class`" to "`public abstract class`"
compare files in "`ControllersImpl`" with the corresponding files in "`Controllers`" and adapt if necessary
compare files in "`ControllersImpl`" with the corresponding files in "`Controllers`" and adapt if necessary
methods should be the same with "`override`" instead of "`virtual`"
methods should be the same with "`override`" instead of "`virtual`"
#### - if files are missing:
---
#### - if files are missing (and only then):
copy them from folder `Controllers`, rename them (append `Impl`) and handle them like the already existing files, i.e.:
copy them from folder `Controllers`, rename them (append `Impl`) and handle them like the already existing files, i.e.:
change classnames by appending `Impl` to the original classnames (and change filenames accordingly) and inherit from original class in `Controllers` (instead of `ControllerBase`)
change classnames by appending `Impl` to the original classnames (and change filenames accordingly) and inherit from original class in `Controllers` (instead of `ControllerBase`)
@@ -55,7 +57,9 @@ Add a constructor with this service class variable like in the already existing
remove sample code and replace it by using the appropriate methods of the corresponding classes in the folder `Services`
remove sample code and replace it by using the appropriate methods of the corresponding classes in the folder `Services`
(which you may be have to create)
(which you may be have to create)
### - folder `Models`:
---
### folder `Models`:
add:
add:
```
```
using MongoDB.Bson;
using MongoDB.Bson;
@@ -68,13 +72,13 @@ at the value that is to become the MongoDB ID, add:
[BsonRepresentation(BsonType.String)]
[BsonRepresentation(BsonType.String)]
```
```
### - folder `Services`
### folder `Services`
the folder `Services` should contain one common class with the DatabaseSettings (`DatabaseSettings.cs`) and one with the database-access-methods (create, get, update, remove) for each API. If some are missing create them like the ones you find there. Be aware to add the reference to these in the file `startup.cs` in this case.
the folder `Services` should contain one common class with the DatabaseSettings (`DatabaseSettings.cs`) and one with the database-access-methods (create, get, update, remove) for each API. If some are missing create them like the ones you find there. Be aware to add the reference to these in the file `startup.cs` in this case.
the naming in the DatabaseSettings is the same as defined in `appsettings.json`, which you have to extend when creating new classes in this folder. changed `appsettings.json` in the folder `docker` accordingly. Make sure that the ConnectionString for the database contains the correct IP address as specified in `docker-compose.yml`.
the naming in the DatabaseSettings is the same as defined in `appsettings.json`, which you have to extend when creating new classes in this folder. changed `appsettings.json` in the folder `docker` accordingly. Make sure that the ConnectionString for the database contains the correct IP address as specified in `docker-compose.yml`.
# MongoDB
# MongoDB
if you don't have a MongoDB, follow the instructions in `readme.txt` in `server/programs/MongoDB`
if you don't have a MongoDB, follow the instructions in `readme.md` in `server/programs/MongoDB`
and put MongoDB in folder `server/programs/MongoDB` (download MongoDB as zip-file from https://www.mongodb.com/try/download/community and unzip the file into this directory, so that the bin-directory is in this folder)
and put MongoDB in folder `server/programs/MongoDB` (download MongoDB as zip-file from https://www.mongodb.com/try/download/community and unzip the file into this directory, so that the bin-directory is in this folder)
@@ -98,7 +102,7 @@ the easiest way is to use docker-compose:
open a command shell and use docker-compose (if necessary adapt docker-compose.yml) by executing in `server/src/Org.OpenAPITools`:
open a command shell and use docker-compose (if necessary adapt docker-compose.yml) by executing in `server/src/Org.OpenAPITools`:
```
```
docker-compose up
docker-compose up --force-recreate --remove-orphan --detach
```
```
open http://localhost:8080/openapi/index.html in a web-browser, if you want to check the functionalities using SwaggerUI
open http://localhost:8080/openapi/index.html in a web-browser, if you want to check the functionalities using SwaggerUI