This file contains 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
// Add all the assemblies to MediatR | |
services.AddMediatR(typeof(DABBaseRequest).GetTypeInfo().Assembly); | |
// For all the validators, register them with dependency injection as scoped | |
AssemblyScanner.FindValidatorsInAssembly(typeof(DABBaseRequest).Assembly) | |
.ForEach(item => services.AddScoped(item.InterfaceType, item.ValidatorType)); | |
// Add the custome pipeline validation to DI | |
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(MyCustomPipelineValidationBehavior<,>)); |
This file contains 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
var validator = new DeleteUserRequestValidator(); | |
var result = validator.Validate(request); | |
if (!result.IsValid) | |
{ | |
throw new MyCustomValidationException(result.ToString()); | |
} |
This file contains 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 class MyCustomPipelineValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse> | |
{ | |
private readonly IEnumerable<IValidator> _validators; | |
public MyCustomPipelineValidationBehavior(IEnumerable<IValidator<TRequest>> validators) | |
{ | |
_validators = validators; | |
} | |
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next) |
This file contains 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
$testResultsFolder = 'TestsCodeCoverage' | |
$codeCoverageExecutable = '~\.nuget\packages\microsoft.codecoverage\16.6.1\build\netstandard1.0\CodeCoverage\CodeCoverage.exe' | |
$reportGeneratorDll = '~\.nuget\packages\reportgenerator\4.5.8\tools\netcoreapp3.0\ReportGenerator.dll' | |
Remove-Item $testResultsFolder -Recurse | |
dotnet test . --results-directory:$testResultsFolder'\CodeCoverage' --collect:"Code Coverage" | |
Write-Host 'Code Coverage tests completed' -ForegroundColor Green | |
$recentCoverageFile = Get-ChildItem -File -Filter *.coverage -Path $testResultsFolder'\CodeCoverage' -Name -Recurse | Select-Object -First 1; |
This file contains 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
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.FileProviders; | |
using System.IO; | |
namespace DAB.Api | |
{ |
This file contains 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
ALTER TABLE ApiClaims MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ApiResources MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ApiScopeClaims MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ApiScopes MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ApiSecrets MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ClientClaims MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ClientCorsOrigins MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ClientGrantTypes MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ClientIdPRestrictions MODIFY COLUMN Id int(11) AUTO_INCREMENT; | |
ALTER TABLE ClientPostLogoutRedirectUris MODIFY COLUMN Id int(11) AUTO_INCREMENT; |
This file contains 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
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
using Microsoft.Win32; | |
namespace Wallpaper | |
{ | |
public enum Style : int | |
{ | |
Tile, Center, Stretch, NoChange | |
} |
This file contains 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
Ssl2 Authentication failed because the remote party has closed the transport stream. | |
Ssl3 Authentication failed because the remote party has closed the transport stream. | |
Default Authentication failed because the remote party has closed the transport stream. | |
None The specified value is not valid in the 'SslProtocolType' enumeration. | |
Tls Authentication failed because the remote party has closed the transport stream. | |
Tls11 The remote certificate is invalid according to the validation procedure. | |
Tls12 The remote certificate is invalid according to the validation procedure. |
This file contains 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 class RawSqlExecute | |
{ | |
/// <summary> | |
/// Plain text sql query to a list that can easaly be transformed to a json object | |
/// </summary> | |
/// <param name="dataContext"></param> | |
/// <param name="sql"></param> | |
/// <returns>Dynamic list</returns> | |
public static List<dynamic> GetDynamicResults( | |
DataContext dataContext, |