-
Download MySQL Workbench:
- Go to the MySQL official website.
- Select your operating system and download the installer.
- Run the installer and follow the instructions to install MySQL Workbench on your computer.
-
Download XAMPP:
- Visit the XAMPP official website.
- Download the installer for your operating system.
- Run the installer and follow the steps to install XAMPP.
-
Download Microsoft Visual Studio:
- Navigate to the Microsoft Visual Studio website.
- Download the Community edition (free version).
- Install it on your system and include
.NET desktop development
in the installation options.
-
Open MySQL Workbench:
- Launch the application after installation.
-
Set Up a New Connection:
- Click the + button (New Connection) in the main screen.
- Fill in the connection details:
- Connection Name: Local Host (or any name you prefer).
- Hostname: 127.0.0.1 (this refers to your local machine).
- Port: 3306 (default MySQL port).
- Username: root (default MySQL username).
- Save the connection and test it to ensure it works.
-
Open XAMPP Control Panel:
- Launch XAMPP after installation.
-
Start the Required Services:
- Start Apache (web server).
- Start MySQL (database server).
-
Access phpMyAdmin:
- Click the Admin button next to MySQL in the XAMPP control panel.
- This will open your default web browser and redirect you to the phpMyAdmin page where you can manage your databases.
- Open your project directory in a terminal or command prompt.
- Use the following command to create an initial migration for your database schema:
dotnet ef migrations add InitialCreate
- This will generate a migration file that describes the changes to your database schema.
-
Apply the migration to update your database schema:
dotnet ef database update
- This will apply all pending migrations to your database.
-
If you want to generate a migration script (SQL script), use:
dotnet ef migrations script
-
Build your project to ensure everything is working properly:
dotnet build
-
Run the application to test it:
dotnet run
- Locate the
CompanyManagementSystem.sln
file in your project directory. - Double-click the file to open it in Microsoft Visual Studio.
- Use Visual Studio to review, debug, and edit your application as needed.
- Make sure the database connection settings (e.g.,
connection string
inappsettings.json
) match your local MySQL setup. - Ensure that XAMPP services (Apache and MySQL) are running whenever you work with your application.
- Always test your migrations and database updates on a non-production environment first.