Skip to content

Instantly share code, notes, and snippets.

[DataContract]
public class Order: ExtensibleDynamicObject
{
[DataMember]
public string CustomerCategory { get; set; }
[DataMember]
public int TableNumber { get; set; }
[DataMember]
public string Server { get; set; }
[DataMember]
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
@pawelpabich
pawelpabich / gist:7301628
Last active December 27, 2015 09:09
Long - 0.4s NullableLong - 4s Why? Have a look at Joe Albahari's presentation, around 1:02h mark. http://www.youtube.com/watch?v=aZCzG2I8Hds
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
@pawelpabich
pawelpabich / Error
Last active December 27, 2015 18:39
It looks like Dynamic Proxy struggles with optional nullable value types
using System;
using Autofac;
using Autofac.Extras.DynamicProxy2;
using Castle.DynamicProxy;
namespace DynamicProxy
{
//1. Install-Package Autofac
//2. Install-Package Autofac.Extras.DynamicProxy2
//3. F5
builder.RegisterAssemblyTypes(thisAssembly)
.Where(type => type.Implements<IToResolve>())
.AsImplementedInterfaces()
.InstancePerLifetimeScope()
// What is the name of MyCustomRegistrationCallback in AutoFac lingo?
// Does it even exist?
.MyCustomRegistrationCallback(data =>
{
if (data.Type == typeof (ThisOneType))
{
@pawelpabich
pawelpabich / gist:7762655
Created December 3, 2013 01:59
Custom NSubstitute collection matcher based on the content of the collection. There must be a better way?
private static IEnumerable<int> MatchSingleItemInCollection(int value)
{
return Arg.Is<IEnumerable<int>>(coll => coll.Single() == value);
}
@pawelpabich
pawelpabich / 1.TestCase
Created January 7, 2014 23:12
Quartz.Net sample that should output text to console every 6 seconds but it does not.
using System;
using System.Collections.Specialized;
using System.Diagnostics;
using Quartz;
using Quartz.Impl;
using Quartz.Impl.Triggers;
namespace ConsoleApplication5
{
class Program
@pawelpabich
pawelpabich / Private Setter
Created March 25, 2014 05:33
Trying to serialize and deserialize a class with private setter in the base class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ConsoleApplication12
{
class Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
using System;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Sdk;
namespace XUnitMany
{
public class Class1