Skip to content

Instantly share code, notes, and snippets.

View AlonAm's full-sized avatar

Alon Amsalem AlonAm

View GitHub Profile
<PropertyGroup>
<WixToolPath>$(MSBuildProjectDirectory)..\..\..\Tools\Wix\3.9</WixToolPath>
<WixTargetsPath>$(WixToolPath)\wix.targets</WixTargetsPath>
<WixTasksPath>$(WixToolPath)\WixTasks.dll</WixTasksPath>
</PropertyGroup>
<Target Name="BeforeBuild">
<Exec Command="attrib -R %(ProjectReference.Filename).wxs" Condition="'%(ProjectReference.WebProject)'=='True'" />
<MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=AnyCPU" Condition="'%(ProjectReference.WebProject)'=='True'" />
<ItemGroup>
<LinkerBindInputPaths Include="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" />
</ItemGroup>
<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="INSTALLFOLDER" ComponentGroupName="%(ProjectReference.Filename)" AutogenerateGuids="True" SuppressCom="True" SuppressFragments="True" SuppressRegistry="True" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.WebProject)'=='True'" />
</Target>
@AlonAm
AlonAm / NLoadExample.cs
Last active August 29, 2015 14:24
NLoad Example
var loadTest = NLoad.Test<MyTest>()
.WithNumberOfThreads(100)
.WithDurationOf(TimeSpan.FromMinutes(5))
.WithDeleyBetweenThreadStart(TimeSpan.FromMilliseconds(50))
.OnHeartbeat((s, e) => Console.WriteLine(e.Throughput))
.Build();
var result = loadTest.Run();
public class MediatorPipeline<TRequest, TResponse>
: IRequestHandler<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
private readonly IRequestHandler<TRequest, TResponse> _inner;
private readonly IPreRequestHandler<TRequest>[] _preRequestHandlers;
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] _postRequestHandlers;
public MediatorPipeline(
IRequestHandler<TRequest, TResponse> inner,
public class AsyncMediatorPipeline<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse>
where TRequest : IAsyncRequest<TResponse>
{
private readonly IAsyncRequestHandler<TRequest, TResponse> _inner;
private readonly IAsyncPreRequestHandler<TRequest>[] _preRequestHandlers;
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] _postRequestHandlers;
public AsyncMediatorPipeline(
IAsyncRequestHandler<TRequest, TResponse> inner,
IAsyncPreRequestHandler<TRequest>[] preRequestHandlers,
public interface IPreRequestHandler<in TRequest>
{
void Handle(TRequest request);
}
public interface IAsyncPreRequestHandler<in TRequest>
{
Task Handle(TRequest request);
}
public class MediatorPipelineModule : Autofac.Module
{
protected override void Load(ContainerBuilder builder)
{
RegisterPipeline(builder);
RegisterAsyncPreRequestHandlers(builder);
RegisterAsyncPostRequestHandlers(builder);
RegisterPreRequestHandlers(builder);
RegisterPostRequestHandlers(builder);
}
@AlonAm
AlonAm / SignalGenerator.cs
Created February 8, 2016 09:06
Simple Signal Generator
class SignalGenerator
{
long startTime = Stopwatch.GetTimestamp();
long ticksPerSecond = Stopwatch.Frequency;
float amplitude = 1f;
float frequency = 1f;
float phase = 1f;
float offset = 0f;
@AlonAm
AlonAm / SignalGenerator.cs
Created February 8, 2016 09:06
Simple Signal Generator
class SignalGenerator
{
long startTime = Stopwatch.GetTimestamp();
long ticksPerSecond = Stopwatch.Frequency;
float amplitude = 1f;
float frequency = 1f;
float phase = 1f;
float offset = 0f;
using Autofac;
using Autofac.Core;
using Cloudinator.Portal.WebApi.Infrastructure;
using Cloudinator.Portal.WebApi.Infrastructure.Handlers;
using FluentValidation;
using MediatR;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;