Skip to content

Instantly share code, notes, and snippets.

View srogovtsev's full-sized avatar

Sergei Rogovtcev srogovtsev

View GitHub Profile
@srogovtsev
srogovtsev / AspNetCoreOwinMiddleware.cs
Created December 31, 2020 11:18 — forked from oliverhanappi/AspNetCoreOwinMiddleware.cs
Running ASP.NET Core within IIS
public class AspNetCoreOwinMiddleware<TAspNetCoreStartup> : OwinMiddleware, IServer
where TAspNetCoreStartup : class
{
private readonly IWebHost _webHost;
private Func<IOwinContext, Task> _appFunc;
IFeatureCollection IServer.Features { get; } = new FeatureCollection();
public AspNetCoreOwinMiddleware(OwinMiddleware next, IAppBuilder app)
: base(next)
@srogovtsev
srogovtsev / AutofacSerilogBench.cs
Created June 24, 2020 10:35
A benchmark for AutofacSerilogIntegration under different registrations
using System;
using Autofac;
using AutofacSerilogIntegration;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using Serilog;
namespace AutofacSerilogBench
{
@srogovtsev
srogovtsev / CROSS JOIN execution plan.xml
Created July 12, 2019 15:36
INNER JOIN (OR) vs UNION
<?xml version="1.0" encoding="utf-16"?>
<ShowPlanXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.6" Build="14.0.2002.14" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementCompId="1" StatementEstRows="1000" StatementId="1" StatementOptmLevel="FULL" CardinalityEstimationModelVersion="140" StatementSubTreeCost="3568.39" StatementText="SELECT TOP (1000) &#xD;&#xA; [Extent1].ID, &#xD;&#xA; [Extent1].[Name] AS [Name], &#xD;&#xA; [Extent2].[Name] AS [Name1]&#xD;&#xA; FROM [dbo].[Customer] AS [Extent1]&#xD;&#xA; CROSS JOIN [dbo].[Ref] AS [Extent2]&#xD;&#xA; WHERE [Extent1].[Ref_ID] = [Extent2].[ID] OR [Extent1].[Ref_ID2] = [Extent2].[ID2]" StatementType="SELECT" QueryHash="0x664E351C3880C4F6" QueryPlanHash="0xB5694E3EF22915FB" RetrievedFromCache="true" SecurityPolicyApplied="false">
<StatementSetOptions ANSI_NULLS="true" ANSI_PADDIN
@srogovtsev
srogovtsev / EmbeddedResourceStream.cs
Created July 24, 2015 09:40
Embedded Resource Reading
using (var ms = GetType().Assembly.GetManifestResourceStream(GetType().Namespace + "." + fileName).CheckNull(() => new InvalidOperationException()))
{
//whatever you want
}