DbConnect is coded around MySqlConnector, an ADO.NET data provider for MySQL. It provides implementations of different classes needed to query and update databases from managed code.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
To start working on this project you need to download and install the following components:
- .NET Core SDK (Software Development Kit)
- Visual Studio Code (Code editor)
- git (Distributed version control system)
- Download the files from Github.
-
Get the latest version of .NET Core on the dotnet web site.
-
When the installation is complete, open a new command prompt and run the following command:
\> dotnet --info
The command should print out information about the version, the runtime environment and a list of .NET Core SDKs installed.
.NET Core SDK (reflecting any global.json): Version: 3.1.300 Commit: b2475c1295
Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.300\
-
Download the latest version of Visual Studio Code installer for Windows.
-
Once it is downloaded, run the installer (VSCodeUserSetup-{version}.exe).
-
By default, Visual Studio Code is installed under C:\users{username \AppData\Local\Programs\Microsoft VS Code.
This procedure assumes you want to use a distributed version control system to contribute to this project. Git is not mandatory to develop or to simply run an ASP.NET Core web application. In this case, simply download the repository from Github using the ZIP file option.
-
Download the latest version of the git installer for Windows.
-
Run the installer (Git-{version}-64-bit.exe).
-
The installer allow you to select the default text editor for Git. Accept the default if you prefer to change this later.
-
When the installation is complete, open Git Bash and run the following command:
\> git --version
- The command should print out information about the version.
git version 2.22.0.windows.1
This procedure assumes you have already created a repository on GitHub, or have an existing repository owned by someone else you'd like to contribute to.
- Create the directory on your local machine where you want this project to reside.
\> mkdir C:\Project\DbConnectCore
\> cd .\Project\DbConnectCore
-
Open your browser and navigate to Github. Access the main page of the repository.
-
Next, get a copy of the project in a ZIP file or using git commands. Follow procedures below.
-
Under the repository name, click Clone or download.
-
Select Download ZIP.
-
Extract the ZIP file in your project folder (ex C:\Project\DbConnectCore).
-
Under the repository name, click Clone or download.
-
In the Clone with HTTPs section, copy the clone URL for the repository.
-
Open Git Bash.
-
Navigate to the project directory where you want the cloned directory to be made (C:\Project\DbConnectCore).
-
Type git clone, and then paste the URL you copied in Step 2.
\>git clone https://github.com/residentsystem/DbConnect
- Press Enter. Your local clone will be created.
- Change the current working directory to the project folder and open the project using Visual Studio Code.
\> cd C:\Project\DbConnectCore\DbConnect
\> code .
-
Using VS Code, select Terminal -> New Terminal. Inside the terminal, run the application.
-
Open file appsettings.json and add configuration options. Each section represent a database configuration.
{ "Database1": { "ConnectionString": "server=localhost;port=3306;database=Database;user=Username;password=Password", "SqlCommand": "SELECT table.column FROM database.table" } }
- Then run the command:
\> dotnet run -ping Database1
Note: When a database is available, -ping will tell you if the database is online. The same command with option -sql instead will execute the SQL statement found under SqlCommand in the configuration file.
When you are done with development and testing and ready to make use of the application, you will need to publish it first. The dotnet publish command will compile the code and then copy the files required to run the application into a publish folder.
- Create a folder where you wish to have the published files located. Change the current working directory to the project folder.
\> mkdir C:\Publish\DbConnect
\> cd C:\Project\DbConnectCore\DbConnect
- Run this command to Publish the application.
\> dotnet publish -o "C:\Publish\DbConnect" -c Release
-
In case the excel template file was not copied properly, copy the file Flows.xlsx to C:\Publish\DbConnect.
-
Go to the publish folder and run the project exe.
\> cd C:\Publish\DbConnect
\> dotnet .\DbConnect.exe
- The command should print information about the hosting environment, url and port listening but this time the hosting environment will indicate "Production".
- Visual Studio Code - Code editor
- .NET Core SDK 3.1.300 - Open-source development platform
Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Eric Lacroix - Initial work
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details