Skip to content

Instantly share code, notes, and snippets.

class MyFeature : FeatureSchemaBase
{
class MyFunc : Function
{
public MyFunc(string schema) : base(new DbObjectName(schema, "hello"))
{
}
public override void Write(DdlRules rules, StringWriter writer)
{
@jokokko
jokokko / Sample.cs
Created June 5, 2019 11:35
Marten & rehydrating instances of types generated via Roslyn
namespace Marten.Samples.GeneratedType
{
class Program
{
static void Main(string[] args)
{
var store = DocumentStore.For(c =>
{
c.Connection("cstring");
c.AutoCreateSchemaObjects = AutoCreate.All;
@jokokko
jokokko / bench.md
Created January 17, 2019 08:48
IdentityMap - ConcurrentDictionary vs. ImHashMap
BenchmarkDotNet=v0.11.3, OS=Windows 10.0.17134.523 (1803/April2018Update/Redstone4)
Intel Core i7-6700 CPU 3.40GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
Frequency=3328124 Hz, Resolution=300.4696 ns, Timer=TSC
.NET Core SDK=2.2.101
  [Host]     : .NET Core 2.1.7 (CoreCLR 4.6.27129.04, CoreFX 4.6.27129.04), 64bit RyuJIT
  DefaultJob : .NET Core 2.1.7 (CoreCLR 4.6.27129.04, CoreFX 4.6.27129.04), 64bit RyuJIT
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Baseline;
using Marten.Util;
namespace Marten.Services
{
public enum UnitOfWorkOrigin
using System;
using System.Text;
namespace Marten.Services.Events
{
public class AssertEventStreamMaxEventId : IStorageOperation
{
private readonly Guid stream;
private readonly int expectedVersion;
private readonly string tableName;
@jokokko
jokokko / proj.cs
Last active March 10, 2016 17:26
Marten / Projecting documents
public class ProjectionSource
{
public Guid Id = Guid.NewGuid();
public string Value { get; set; }
public int AnotherValue { get; set; }
public object ThirdValue { get; set; }
}
public class ProjectionTarget
public interface IEventStoreTest
{
}
internal static class EventStoreTestMixins
{
...
public static EventStoreHelper StartInMemStore(this IEventStoreTest test)
{
@jokokko
jokokko / gist:8538f5c203a6464e8801
Created July 29, 2014 15:09
NSB manual consumer wireup
public static class SubscriptionExtensions
{
internal sealed class UsingCustomMessageHandlerRegistry
{
}
public static void Consumer<T>(this UnicastBus busInstance, IHandleMessages<T> handler)
{
var currentConfiguration = Configure.Instance;
MessageHandlerRegistry messageHandlerRegistry;