ASP.NET Core sample app illustrating how to use Entity Framework Core together with the Steeltoe SQL Server Connector for connecting to a Microsoft SQL Server database.
- Installed .NET 8 SDK
- Optional: VMware Tanzu Platform for Cloud Foundry (optionally with Windows support) with VMware Tanzu Cloud Service Broker and Cloud Foundry CLI
- Use LocalDB or start a SQL Server docker container
- When using docker, update your connection string in
appsettings.Development.json
accordingly
- When using docker, update your connection string in
- Run the sample
dotnet run
Upon startup, the app inserts a couple of rows into the bound SQL Server database. They are displayed on the home page.
- Create a SQL Server service instance in an org/space
cf target -o your-org -s your-space cf create-service csb-azure-mssql mini sampleSqlServerService
- Wait for the service to become ready (you can check with
cf services
) - Run the
cf push
command to deploy from source (you can monitor logs withcf logs sqlserver-efcore-connector-sample
)- When deploying to Windows, binaries must be built locally before push. Use the following commands instead:
dotnet publish -r win-x64 --self-contained cf push -f manifest-windows.yml -p bin/Release/net8.0/win-x64/publish
- When deploying to Windows, binaries must be built locally before push. Use the following commands instead:
- Copy the value of
routes
in the output and open in your browser
See the Official Steeltoe Connectors Documentation for a more in-depth walkthrough of the samples and more detailed information.