MySql Connector Sample App - MySqlConnection
This sample uses
MySqlConnection to work with the database and Autofac for IoC services.
Pre-requisites - CloudFoundry
- Installed Pivotal CloudFoundry 1.7+
- Installed Windows support
- Installed MySql marketplace service
Create MySql Service Instance on CloudFoundry
You must first create an instance of the MySql service in a org/space.
cf target -o myorg -s development
cf create-service p-mysql 100mb myMySqlService
Publish App & Push to CloudFoundry
- Open Samples\Connectors\src\AspDotNet4\Connectors.sln in Visual Studio 2017.
- Select MySql4 project in Solution Explorer.
- Right-click and select Publish
FolderProfileto publish to
- Use the CF CLI to push the app
> cd samples\Connectors\src\AspDotNet4\MySql4 > cf push -p bin\Debug\net461\win10-x64\publish
Note: The provided manifest(s) will create an app named
mysql-connector-4xand attempt to bind the app to MySQL service
What to expect - CloudFoundry
Use the Cloud Foundry CLI to see the logs as you startup and use the app, with the command
cf logs mysql-connector-4x
This sample will be available at http://mysql-connector-4x.[your-cf-apps-domain]/.
Upon startup, the app inserts two rows into the bound MySql database. To display those rows click on the
MySql Data link in the menu.