Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fschmied
fschmied / GitExtensions.msi
Last active May 29, 2019 10:47
GitExtensionsBug_5944-quickfix-build-based-3.1
This file has been truncated, but you can view the full file.
@fschmied
fschmied / PathTooLongException.gif
Last active February 6, 2019 08:23
GitExtensions bug #6170
PathTooLongException.gif
@fschmied
fschmied / PersistCommit.sql
Created March 28, 2016 16:46
NEventStore's MsSql PersistCommit query
INSERT
INTO Commits
( BucketId, StreamId, StreamIdOriginal, CommitId, CommitSequence, StreamRevision, Items, CommitStamp, Headers, Payload )
OUTPUT INSERTED.CheckpointNumber
VALUES (@BucketId, @StreamId, @StreamIdOriginal, @CommitId, @CommitSequence, @StreamRevision, @Items, @CommitStamp, @Headers, @Payload);
@fschmied
fschmied / Commits.sql
Last active March 28, 2016 16:47
NEventStore's MsSql Commits table setup
IF EXISTS(SELECT * FROM sysobjects WHERE name='Commits' AND xtype = 'U') RETURN;
CREATE TABLE [dbo].[Commits]
(
[BucketId] [varchar](40) NOT NULL,
[StreamId] [char](40) NOT NULL,
[StreamIdOriginal] [nvarchar](1000) NOT NULL,
[StreamRevision] [int] NOT NULL CHECK ([StreamRevision] > 0),
[Items] [tinyint] NOT NULL CHECK ([Items] > 0),
[CommitId] [uniqueidentifier] NOT NULL CHECK ([CommitId] != 0x0),
[CommitSequence] [int] NOT NULL CHECK ([CommitSequence] > 0),
@fschmied
fschmied / GetFrom.sql
Created March 28, 2016 16:43
NEventStore's MsSql GetFrom (checkpoint) query
WITH [cte] AS
( SELECT BucketId, StreamId, StreamIdOriginal, StreamRevision, CommitId, CommitSequence, CommitStamp, CheckpointNumber, Headers, Payload
, ROW_NUMBER() OVER (ORDER BY CheckpointNumber) AS [row] FROM Commits WITH (READCOMMITTEDLOCK)
WHERE CheckpointNumber > @CheckpointNumber
)
SELECT *
FROM [cte]
WHERE [row] BETWEEN @Skip + 1
AND @Limit + @Skip;
@fschmied
fschmied / gist:418e38425f83fb81b833
Created January 6, 2015 19:52
Catch-up subscription
public class EventSubscriber : IEventSubscriber
{
private IReadModelPersistence _persistence;
public void CatchUpAndSubscribe (IEventBus eventBus, IEventStore eventStore)
{
CatchUpUntilNow(eventStore);
eventBus.Subscribe (this);
CatchUpUntilNow(eventStore);
}
using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
namespace ConsoleApplication39
{
internal class Program
{
private static void Main (string[] args)
@fschmied
fschmied / gist:9473772
Created March 10, 2014 20:37
Triggers AutoMapper threading issue
using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
namespace ConsoleApplication39
{
internal class Program
{
private static void Main (string[] args)