This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DependencyRegistrationBootstrapper | |
{ | |
public static void RegisterDependencies(this IServiceCollection services) | |
{ | |
// Register three implementations | |
services.AddKeyedTransient<IReminderService, SmsReminderService>(ReminderType.Sms); | |
services.AddKeyedTransient<IReminderService, EmailReminderService>("Email"); | |
services.AddKeyedTransient<IReminderService, PushNotificationReminderService>(ReminderType.PushNotifications); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --------------------------------------------------------------------------------- | |
// DEMO 1 - Inject using FromKeyedServices attribute | |
// --------------------------------------------------------------------------------- | |
[Route("api/[controller]")] | |
[ApiController] | |
public class FirstController : ControllerBase | |
{ | |
// This should be email service implementation | |
private readonly IReminderService reminderService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum ReminderType | |
{ | |
Email, | |
Sms, | |
PushNotifications | |
} | |
//--------------------------------------------------------------------------------- | |
// One Interface - Three Implementations | |
//--------------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## -------------------------------------------------------------------------------- | |
## STEP 1 - INSTALL DOTNET-SONARSCANNER (One Time Setup) | |
## -------------------------------------------------------------------------------- | |
dotnet tool install --global dotnet-sonarscanner | |
## -------------------------------------------------------------------------------- | |
## STEP 2 - BEGIN ANALYSIS | |
## -------------------------------------------------------------------------------- | |
dotnet sonarscanner begin /k:"sample-web-api" /d:sonar.token="sqa_1s2s3om4t5o6k7e8e9n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## -------------------------------------------------------------------------------- | |
## STEP 1 - INSTALL DOTNET-SONARSCANNER (One Time Setup) | |
## -------------------------------------------------------------------------------- | |
## To install dotnet sonarscanner tool globally (latest version) | |
## You can also specify the version you want to install using --version argument | |
dotnet tool install --global dotnet-sonarscanner | |
## -------------------------------------------------------------------------------- | |
## STEP 2 - BEGIN ANALYSIS | |
## -------------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wsl -d docker-desktop | |
sysctl -w vm.max_map_count=524288 | |
sysctl -w fs.file-max=131072 | |
ulimit -n 131072 | |
ulimit -u 8192 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
sonarqube: | |
image: sonarqube:community | |
depends_on: | |
- db | |
environment: | |
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar | |
SONAR_JDBC_USERNAME: sonar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
## Note: This script should be executed | |
## from the machine where the remote repository is cloned. | |
################################################################ | |
## Parameter is_dry_run, defaulted to true to avoid deletion by mistake | |
## Invoke Command - "$ delete-stale-branches.ps1 -is_dry_run $true" | |
param([Boolean]$is_dry_run = $true) | |
##--------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Checkout the main branch | |
## If your main branch name is different, use that name instead of 'main' | |
git checkout main | |
## This will remove the branches | |
## which are present on local but are deleted on remote | |
git fetch --prune | |
## The below command will get all branches which are merged | |
## Then it will remove the names 'main', 'master', 'develop' from the list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$devopsApiVersion = "7.0" | |
$newBranch = "sprint/userStoryNumber"; | |
$baseBranch = "master"; | |
$organization = "contoso"; | |
$project = "contoso"; | |
$repository = "contosowebapp"; | |
## ----------------------------------------------------------------- | |
## Create Branch | |
## ----------------------------------------------------------------- |
NewerOlder