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 delegate IQueryable<T> QueryMutator<T>(IQueryable<T> item); | |
/// <summary> | |
/// Mutator class | |
/// </summary> | |
/// <typeparam name="TSearch">Predicate expression</typeparam> | |
/// <typeparam name="TQuery">Query expression if TSearch == true</typeparam> | |
public class SearchFieldMutator<TSearch, TQuery> | |
{ | |
public Predicate<TSearch> Condition { get; set; } |
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
services.AddWebOptimizer(x => | |
{ | |
x.AddBundle("/css/site.css", "text/css;charset=UTF-8", "static/css/styles.css") | |
.UnCss() | |
.MinifyCss() | |
.AutoPrefixCss() | |
.Concatenate() | |
.FingerprintUrls(); | |
}); |
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
// -------------------------------------------------------------------------------------------------------------------- | |
// <copyright file="RandomStringGenerator.cs" company=""> | |
// Nero Sule | |
// </copyright> | |
// <summary> | |
// Class for random string generation. Does not include ambiguous characters like | |
// I, 1 and l. | |
// Every four characters include one lower case character, one upper case character, | |
// one number and a special symbol in a random order. String will start with | |
// an alphanumeric character. |
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
-- Outermost query for the final projection of the calculated values | |
SELECT | |
ProjectId, -- Primary key of the project | |
ProjectName, -- Name of the project | |
ProjectArchived, -- Whether the project is archived | |
ProjectQuotedDayRate, -- Daily rate quoted for the client | |
ProjectBaseDayRate, -- Estimated day rate for the project (cost to the company) | |
ProjectTotalBudget, -- Total budget (amount billed to the client) of the project | |
CurrencyCode, -- Currency code (presently only 'GDP') | |
ClientId, -- Primary key of the client |
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
<?php | |
// CORE/app/models/datasources/json_source.php | |
/** | |
* JSON Source module for CakePHP. | |
* | |
* @package cake | |
*/ | |
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
#addin nuget:?package=Newtonsoft.Json&version=12.0.1 | |
using Newtonsoft.Json; | |
public class EfMigration | |
{ | |
public string Id { get; set; } | |
public string Name { get; set; } | |
public string SafeName { get; set; } | |
} |
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 PageRouteConstraint : IRouteConstraint | |
{ | |
private static readonly Regex regex = new Regex($"^page=(\\d+)$"); | |
public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection) | |
{ | |
if (routeDirection != RouteDirection.IncomingRequest || !values.TryGetValue(routeKey, out var page)) | |
{ | |
return false; | |
} |
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 abstract class AbstractAsyncInitializationMiddleware | |
{ | |
private readonly RequestDelegate next; | |
private readonly ILogger logger; | |
private Task initializationTask; | |
// ReSharper disable AccessToModifiedClosure | |
protected AbstractAsyncInitializationMiddleware(RequestDelegate next, IApplicationLifetime lifetime, ILogger logger) | |
{ | |
this.next = 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
public async Task<Model> Handle(Request request, CancellationToken cancellationToken) | |
{ | |
var query = context.Tickets.AsNoTracking().AsQueryable(); | |
query = FilterQuery(query, request); | |
var total = await query.CountAsync(cancellationToken); | |
query = OrderQuery(query, request); | |
query = PageQuery(query, request); |
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 MySigninManager : SignInManager<IdentityUser> | |
{ | |
public MySigninManager(UserManager<IdentityUser> userManager, IHttpContextAccessor contextAccessor, | |
IUserClaimsPrincipalFactory<IdentityUser> claimsFactory, IOptions<IdentityOptions> optionsAccessor, | |
ILogger<SignInManager<IdentityUser>> logger, IAuthenticationSchemeProvider schemes) | |
: base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes) | |
{ | |
} | |
protected override async Task<SignInResult> SignInOrTwoFactorAsync(IdentityUser user, bool isPersistent, string loginProvider = null, bool bypassTwoFactor = false) |
NewerOlder