Skip to content

Instantly share code, notes, and snippets.

View eshapovalova's full-sized avatar
👋
Hello

Elena Shapovalova eshapovalova

👋
Hello
  • Phuket
View GitHub Profile
@eshapovalova
eshapovalova / AsysnAwaitDemo.cs
Created November 15, 2018 01:03
AsyncAwaitDemo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace AsyncAwaitDemo
{
class Program
@eshapovalova
eshapovalova / QueryExtensions.cs
Created April 27, 2017 13:57
QueryExtensions helper for dynamic build LINQ queries using Extensions and dynamic LINQ
using KindergartenApp.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic;
using System.Linq.Expressions;
using System.Reflection;
using KindergartenApp.Core.Filtering;
namespace KindergartenApp.Core.Extensions
@eshapovalova
eshapovalova / ArrayExceptionAttribute.cs
Created August 7, 2016 19:15
Кастомный фильтр исключения - Web API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Filters;
 
@eshapovalova
eshapovalova / CustomAuthorizationAttribute.cs
Created August 7, 2016 19:13
Кастомный фильтр авторизации - Web API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
@eshapovalova
eshapovalova / CustomAuthenticationAttribute.cs
Created August 7, 2016 19:12
Custom Authentication Filter for Web API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Filters;
using System.Web.Http.Results;
using System.Security.Principal;
using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http.Routing;
 
namespace WebApiApp.Util
{
    public class CustomConstraint: IHttpRouteConstraint
    {
        private string uri;
        public CustomConstraint(string uri)
@eshapovalova
eshapovalova / SqlQueryTemplates.cs
Created October 14, 2015 11:39
SQL Queries for TecDOC
namespace GarantaParts.Engine.Import.TecDoc
{
public class SqlQueryTemplates
{
public static string ArticleSearchTemplate = @"
SELECT DISTINCT
TOF_ARTICLES.ART_ID,
TOF_BRANDS.BRA_BRAND,
TOF_SUPPLIERS.SUP_ID,
@eshapovalova
eshapovalova / category_tree_view.sql
Created October 14, 2015 11:34
NESTED TREE (вспомнила)
SELECT node.Id, node.Title, node.LeftIndex, node.RightIndex, node.MetaTitle, node.MetaKeywords, node.MetaDescription, node.Cover, (COUNT(parent.Title) - 1) AS depth
FROM {0}.Categories AS node, {0}.Categories AS parent
WHERE node.LeftIndex BETWEEN parent.LeftIndex AND parent.RightIndex
GROUP BY node.Id, node.Title, node.LeftIndex, node.RightIndex, node.MetaTitle, node.MetaKeywords, node.MetaDescription, node.Cover
ORDER BY node.LeftIndex
public class UnityApiControllerActivator : IHttpControllerActivator
{
private readonly IUnityContainer _container;
public UnityApiControllerActivator(IUnityContainer container)
{
_container = container;
}
public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
@eshapovalova
eshapovalova / gist:0d44968f97aa71ac662e
Created June 11, 2014 03:03
Hack for not correct Blob Storage Service Version (large files, partial content, stream allow)
var storageAccount = CloudStorageAccount.Parse("AccountName=<accountName>;AccountKey=<accountKeyBase64>;DefaultEndpointsProtocol=http");
var blobClient = storageAccount.CreateCloudBlobClient();
// Get the current service properties
var serviceProperties = blobClient.GetServiceProperties();
// Set the default service version to 2011-08-18 (or a higher version like 2012-03-01)
serviceProperties.DefaultServiceVersion = "2011-08-18";
// Save the updated service properties