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 Microsoft.AspNetCore.Mvc; | |
| using Microsoft.AspNetCore.Mvc.Filters; | |
| namespace Example | |
| { | |
| public class ModelStateValidationFilter : Attribute, IActionFilter | |
| { | |
| public void OnActionExecuting(ActionExecutingContext context) | |
| { |
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 SaltService : ISaltService | |
| { | |
| public string Generate() | |
| { | |
| var saltBytes = new byte[8]; | |
| using (var rng = RandomNumberGenerator.Create()) | |
| { | |
| rng.GetBytes(saltBytes); | |
| } |
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 MpReserver.DataModel.EfEntities.School.Course; | |
| using MpReserver.Reckoning.Search.Params; | |
| namespace MpReserver.Reckoning.Search.Filters | |
| { | |
| // TODO: Rewrite this with specifications pattern. |
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
| DECLARE @Result VARCHAR(MAX), | |
| @TableName SYSNAME = 'IncomeShippingProductsServices', | |
| @CLASSNAME NVARCHAR(500) = 'public class '; | |
| SET @Result = @CLASSNAME + @TableName + ' | |
| {' | |
| SELECT @Result = @Result + ' | |
| public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }' |
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 LinqToSqlHelper | |
| { | |
| public static (string, IReadOnlyDictionary<string, object>) ToSqlWithParams<TEntity>(this IQueryable<TEntity> query) | |
| { | |
| var enumerator = query.Provider | |
| .Execute<IEnumerable<TEntity>>(query.Expression) | |
| .GetEnumerator(); | |
| const BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance; | |
| var enumeratorType = enumerator.GetType(); | |
| var selectFieldInfo = enumeratorType.GetField("_selectExpression", bindingFlags) ?? throw new InvalidOperationException($"cannot find field _selectExpression on type {enumeratorType.Name}"); |
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
| const fileUrl = window.URL.createObjectURL(downloadEvent.response); | |
| const extension = getFileExtension(file.originalFileName); | |
| const MimeTypesMap = { | |
| png: 'image/png', | |
| gif: 'image/gif', | |
| jpg: 'image/jpg', | |
| jpeg: 'image/jpeg', | |
| pdf: 'application/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
| import { Directive, HostListener } from '@angular/core'; | |
| import { NgControl } from '@angular/forms'; | |
| @Directive({ | |
| selector: '[formControlName][appPhoneMask]', | |
| }) | |
| export class PhoneMaskDirective { | |
| constructor(public ngControl: NgControl) { } |
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
| import { useEffect, useState } from "react"; | |
| import "./styles.css"; | |
| function lazy(importFunc, { fallback }) { | |
| return function () { | |
| const [{ state, component: Component }, changeState] = useState({ | |
| state: "loading", | |
| component: null | |
| }); | |
| useEffect(() => { |
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 SftpConfig | |
| { | |
| public string Host { get; set; } | |
| public int Port { get; set; } | |
| public string User { get; set; } | |
| public string Password { get; set; } | |
| public string RemoteFilePath { get; set; } | |
| public string LocalFilePath { get; set; } | |
| } |