- .NET 9.0 SDK
- SQL Server (local, docker or remote instance)
- IDE (Visual Studio, JetBrains Rider or Visual Studio Code) or .NET CLI
Update the connection string in appsettings.json:
{
"ConnectionStrings": {
"SqlServer": "Server=YOUR_SERVER;Database=YOUR_DATABASE;User Id=YOUR_USER;Password=YOUR_PASSWORD;TrustServerCertificate=True;"
}
}Replace the following placeholders:
YOUR_SERVER- Your SQL Server instance address (e.g.,localhost,127.0.0.1,1433)YOUR_DATABASE- Database nameYOUR_USER- SQL Server usernameYOUR_PASSWORD- SQL Server password- Include
TrustServerCertificateas needed
- Open the solution in your IDE
- Press
F5or click the Run button - The browser will automatically open with Swagger UI
Navigate to the project directory and run:
dotnet runThe application will be available at:
When running from Visual Studio or Rider, the browser will automatically open to the Swagger page.
Check the console logs for messages indicating a successful startup:
- Look for "Now listening on: http://localhost:5001" or "Now listening on: https://localhost:5000"
- Verify no error messages appear during startup
- Confirm database connection is established
- Navigate to the Swagger page (automatically opened or manually visit the URLs above)
- Expand the available endpoints
- Click "Try it out" on any endpoint
- Fill in the required parameters
- Click "Execute" to test the endpoint
- Import or manually create requests for the available endpoints
- Set the base URL to
http://localhost:5001orhttps://localhost:5000 - Send requests and verify responses
- If the application fails to start, check the console logs for error messages
- Verify your SQL Server instance is running and accessible
- Ensure the connection string is correctly configured
- Check that port 5000 (HTTPS) and 5001 (HTTP) are not being used by other applications
This repo includes a BenchmarkDotNet project that measures EF Core vs bulk operations.
- Project path:
ReturningIdentityValue/Benchmarks - Framework:
net9.0
Update the connection string in ReturningIdentityValue/Benchmarks/appsettings.json (and optionally appsettings.Development.json) to point to your SQL Server:
{
"ConnectionStrings": {
"SqlServer": "Server=YOUR_SERVER;Database=YOUR_DATABASE;User Id=YOUR_USER;Password=YOUR_PASSWORD;TrustServerCertificate=True;"
}
}Make sure the target database is reachable and the user has permissions to create tables and insert data.
From the repository root:
dotnet build -c ReleaseFrom the repository root, run the Benchmarks project in Release configuration:
# Run all benchmarks
dotnet run -c Release --project ReturningIdentityValue/BenchmarksBenchmarkDotNet places results under ReturningIdentityValue/Benchmarks/BenchmarkDotNet.Artifacts/results as .md and .html reports.
- Close other heavy applications; keep the machine idle during runs.
- Prefer running on AC power and a performance power plan.
- Use the same SQL Server instance for all runs; ensure it's not under external load.
- Results are comparative; look at ratios between baselines and alternatives.