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
internal class Program | |
{ | |
private const ulong limit = 1; | |
private static void Main(string[] args) | |
{ | |
if (args.Length < 1) | |
{ | |
Console.WriteLine("No start number specified"); | |
return; | |
} |
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 HtmlFileResult : ActionResult | |
{ | |
private readonly string fileDownloadName; | |
private readonly ViewResult viewToRender; | |
public HtmlFileResult(ViewResult viewToRender, string fileDownloadName) | |
{ | |
if (string.IsNullOrWhiteSpace(fileDownloadName)) | |
{ | |
throw new ArgumentException($"'{nameof(fileDownloadName)}' cannot be null or whitespace.", nameof(fileDownloadName)); |
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
// Little extension to do what I need for OpenApi | |
/// <summary> | |
/// Specifies the type of the value, depending on status code and MIME-Types, returned by the action | |
/// </summary> | |
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)] | |
public class ProducesResponseAttribute : Attribute | |
{ | |
public ProducesResponseAttribute(Type type, int statusCode = 200) | |
{ | |
Type = type; |
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 HtmlFileResult : FileResult | |
{ | |
private readonly ControllerContext controllerContext; | |
private readonly string viewToRender; | |
private readonly object model; | |
public HtmlFileResult(ControllerContext controllerContext, string viewToRender, object model, string fileDownloadName) : base("text/html") | |
{ | |
if (string.IsNullOrWhiteSpace(viewToRender)) | |
{ |
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 interface IViewModelValidator | |
{ | |
bool IsValid(object model); | |
} | |
public class DataAnnotationsValidator : IViewModelValidator | |
{ | |
private class ReferenceEqualityComparer : IEqualityComparer<object> | |
{ | |
public new bool Equals(object x, object y) |
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 JsonpResult : JsonResult | |
{ | |
private const string NullCallbackExceptionMessage = "Callback cannot be null."; | |
private const string NullContextExceptionMessage = "Context cannot be null."; | |
private const string JsonpCallbackFormat = "{0}({1});"; | |
private const string JsonpContentType = "application/javascript"; | |
private const string InvalidOperationExceptionMessage = | |
"This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet."; |
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
/// <summary> | |
/// Define an object that encapsulates how a set of objects interact. | |
/// Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. | |
/// </summary> | |
public interface IMediator | |
{ | |
/// <summary> | |
/// Perform a query to the "model". | |
/// </summary> | |
/// <typeparam name="TRequest">The type of the request.</typeparam> |
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
[Route("monitor")] | |
public class MonitorController : Controller | |
{ | |
private readonly IActionDescriptorCollectionProvider _provider; | |
public MonitorController(IActionDescriptorCollectionProvider provider) | |
{ | |
_provider = provider; | |
} |
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
/// <summary> | |
/// AuthHandler for AAD | |
/// </summary> | |
public class ActiveDirectoryAuthHandler : DelegatingHandler | |
{ | |
private const int maxAuthRetry = 3; | |
private readonly AuthenticationContext authContext; | |
private readonly ClientCredential clientCredential; | |
private readonly string appIdUri; |
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 ContainerBasedJobActivator : IJobActivator | |
{ | |
private readonly IDepencencyInjectionContainer container; | |
public ContainerBasedJobActivator(IDepencencyInjectionContainer container) | |
{ | |
if (container == null) throw new ArgumentNullException(nameof(container)); | |
this.container = container; | |
} | |
public T CreateInstance<T>() |
NewerOlder