Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 5. Creating sample applications with .NET 8.0
5.1. Creating the MVC sample application
s2i-dotnetcore-ex
is the default Model, View, Controller (MVC) template application for .NET.
This application is used as the example application by the .NET S2I image and can be created directly from the OpenShift UI using the Try Example link.
The application can also be created with the OpenShift client binary (oc
).
Procedure
To create the sample application using oc
:
Add the .NET application:
$ oc new-app dotnet:8.0-ubi8~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnet-8.0 --context-dir=app
Make the application accessible externally:
$ oc expose service s2i-dotnetcore-ex
Obtain the sharable URL:
$ oc get route s2i-dotnetcore-ex
Additional resources
5.2. Creating the CRUD sample application
s2i-dotnetcore-persistent-ex
is a simple Create, Read, Update, Delete (CRUD) .NET web application that stores data in a PostgreSQL database.
Procedure
To create the sample application using oc
:
Add the database:
$ oc new-app postgresql-ephemeral
Add the .NET application:
$ oc new-app dotnet:8.0-ubi8~https://github.com/redhat-developer/s2i-dotnetcore-persistent-ex#dotnet-8.0 --context-dir app
Add environment variables from the
postgresql
secret and database service name environment variable:$ oc set env dc/s2i-dotnetcore-persistent-ex --from=secret/postgresql -e database-service=postgresql
Make the application accessible externally:
$ oc expose service s2i-dotnetcore-persistent-ex
Obtain the sharable URL:
$ oc get route s2i-dotnetcore-persistent-ex
Additional resources