This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.
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 void AddAny(this IServiceCollection collection, Assembly assembly, Func<Type, bool> implementFactory, ServiceLifetime serviceLifetime) | |
{ | |
var serviceTypes = assembly.GetTypes() | |
.Where(x => !x.IsAbstract && x.GetInterfaces().Any(IsAnyServiceInterface)) | |
.ToList(); | |
serviceTypes.ForEach(x => AddService(collection, x)); | |
bool IsAnyServiceInterface(Type type) | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
namespace DomainServices | |
{ | |
public class DataBuilder<TIn, TOut> where TIn : class where TOut : class, new() | |
{ |
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 class AzureBlobFileClient : IFileClient | |
{ | |
private CloudBlobClient _blobClient; | |
public AzureBlobFileClient(string connectionString) | |
{ | |
var account = CloudStorageAccount.Parse(connectionString); | |
_blobClient = account.CreateCloudBlobClient(); | |
} | |
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
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.Linq; | |
using System.Net.Http.Headers; | |
using Newtonsoft.Json.Linq; | |
namespace HttpUtils | |
{ | |
public static class RestClient | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.Composition; | |
using System.IO; | |
using System.Linq; | |
using com.centralaz.RoomManagement.Attribute; | |
using com.centralaz.RoomManagement.Model; | |
using com.centralaz.RoomManagement.ReportTemplates; | |
using iTextSharp.text; | |
using iTextSharp.text.pdf; |
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
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Usenet.Extensions | |
{ | |
public static class TaskExtensions | |
{ | |
public static async Task<TResult> TimeoutAfter<TResult>(this Task<TResult> task, TimeSpan timeout) | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Gist | |
{ | |
public static class TaskExtensions | |
{ |
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 class RequestResponseLoggingMiddleware | |
{ | |
private readonly RequestDelegate _next; | |
private readonly ILogger _logger; | |
public RequestResponseLoggingMiddleware(RequestDelegate next, | |
ILoggerFactory loggerFactory) | |
{ | |
_next = next; | |
_logger = loggerFactory |
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
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace MyNamespace | |
{ | |
public static class ParallelAsync | |
{ |
NewerOlder